Dim documentBars As ICommandBars = m_Application.Document.CommandBars Dim barID As UID = New UIDClass barID.Value = "BGC_Engineering_Inc_BGCLayout_Tool_v4_BGC_Layout_Tool" '"{ebecdd6c-d4da-4523-b478-aab7f940b87e}" Dim barItem As ICommandItem = documentBars.Find(barID, False, False) If Not (barItem Is Nothing) Then ' AndAlso barItem.Type = ESRI.ArcGIS.Framework.esriCommandTypes.esriCmdTypeToolbar Then Dim commandBar As ICommandBar = CType(barItem, ICommandBar) Dim commandID As ESRI.ArcGIS.esriSystem.UID = New ESRI.ArcGIS.esriSystem.UIDClass commandID.Value = "BGC_Engineering_Inc_BGCLayout_Tool_version_4_btn_Language" Dim contextHelpItem As ICommandItem = commandBar.Find(commandID, False) If Not contextHelpItem Is Nothing Then ' get bitmap 'Dim newIcon As System.Drawing.Bitmap If g_bEnglish = True Then 'newIcon = New System.Drawing.Bitmap(Me.GetType(), "Images/btn_Language_en.bmp") 'contextHelpItem.FaceID = ESRI.ArcGIS.ADF.COMSupport.OLE.GetIPictureDispFromBitmap(newIcon) 'contextHelpItem.Style = esriCommandStyles.esriCommandStyleTextOnly 'contextHelpItem.Caption = "English" contextHelpItem.Tooltip = "Now English" Else 'newIcon = New System.Drawing.Bitmap(Me.GetType(), "Images/btn_Language_es.bmp") 'contextHelpItem.FaceID = ESRI.ArcGIS.ADF.COMSupport.OLE.GetIPictureDispFromBitmap(newIcon) 'contextHelpItem.Style = esriCommandStyles.esriCommandStyleTextOnly 'contextHelpItem.Caption = "Spanish" contextHelpItem.Tooltip = "Now Spanish" End If End If End If
Solved! Go to Solution.
Public Sub ChangeText() Dim pApp As IApplication Set pApp = Application Dim pCBs As ICommandBars Set pCBs = pApp.Document.CommandBars Dim pCI As ICommandItem Set pCI = pCBs.Find("xxx_xxx_xxx") Dim pCB As ICommandBar Set pCB = pCI Debug.Print pCB.Count ' Number of items of toolbar Set pCI = pCB.Item(0) Debug.Print pCI.BuiltIn ' Should returns true, which it does! pCI.Style = esriCommandStyleIconAndText pCI.Caption = "Spanish" pCI.Refresh End Sub
Public Sub ChangeText() Dim pApp As IApplication Set pApp = Application Dim pCBs As ICommandBars Set pCBs = pApp.Document.CommandBars Dim pCI As ICommandItem Set pCI = pCBs.Find("xxx_xxx_xxx") Dim pCB As ICommandBar Set pCB = pCI Debug.Print pCB.Count ' Number of items of toolbar Set pCI = pCB.Item(0) Debug.Print pCI.BuiltIn ' Should returns true, which it does! pCI.Style = esriCommandStyleIconAndText pCI.Caption = "Spanish" pCI.Refresh End Sub
contextHelpItem.Refresh