This document is archived and information here might be outdated.  Recommended version.


Add Network Analyst Commands to ToolbarControl Snippet (ArcObjects .NET 10.6 SDK)
ArcObjects Library Reference

Add Network Analyst Commands to ToolbarControl Snippet

Add the Network Analyst commands to the ToolbarControl.

[C#]
///<summary>Add the Network Analyst commands to the ToolbarControl.</summary>
///      
///<param name="toolbarControl">An IToolbarControl interface. Use the .Object property when passing a control in .NET. Example: axToolbarControl1.Object</param>
///      
///<remarks></remarks>
public void AddNetworkAnalystCommandsToToolbarControl(ESRI.ArcGIS.Controls.IToolbarControl toolbarControl)
{

  // Call to add the network analyst commands to the ToolbarControl
  // For example, if a ToolbarControl named axToolbarControl1 exists use the following code:
  // AddNetworkAnalystCommandsToToolbarControl(axToolbarControl1.Object as ESRI.ArcGIS.Controls.IToolbarControl); 

  toolbarControl.AddToolbarDef("esriControls.ControlsNetworkAnalystToolbar", -1, false, 0, ESRI.ArcGIS.SystemUI.esriCommandStyles.esriCommandStyleIconOnly);
}
[Visual Basic .NET]
'''<summary>Add the Network Analyst commands to the ToolbarControl.</summary>
'''      
'''<param name="toolbarControl">An IToolbarControl interface. Use the .Object property when passing a control in .NET. Example: axToolbarControl1.Object</param>
'''      
'''<remarks></remarks>
Public Sub AddNetworkAnalystCommandsToToolbarControl(ByVal toolbarControl As ESRI.ArcGIS.Controls.IToolbarControl)

  ' Call to add the network analyst commands to the ToolbarControl
  ' For example, if a ToolbarControl named axToolbarControl1 exists use the following code:
  ' AddNetworkAnalystCommandsToToolbarControl (AxToolbarControl1.Object) 

    toolbarControl.AddToolbarDef("esriControls.ControlsNetworkAnalystToolbar", -1, False, 0, ESRI.ArcGIS.SystemUI.esriCommandStyles.esriCommandStyleIconOnly)

End Sub

Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • ESRI.ArcGIS.Controls
  • ESRI.ArcGIS.SystemUI