![]() |
||||
|
This article explains a couple of problems that appear with the commandbars created by a Visual Studio 2005 add-in after the user executes the "Tools", "Import and Export Settings" wizard to import settings. Cause This is a bug of Visual Studio 2005. More Information Steps to reproduce the problem:
Private m_objDTE As DTE
Private m_objCommandBar As CommandBar
Private m_objCommandBarButton As CommandBarButton
Public Sub OnConnection(ByVal application As Object, ByVal connectMode As ext_ConnectMode, _
ByVal addInInst As Object, ByRef custom As Array) Implements IDTExtensibility2.OnConnection
Dim colCommandBars As CommandBars
Dim objCommand As Command
Try
Select Case connectMode
Case ext_ConnectMode.ext_cm_AfterStartup, ext_ConnectMode.ext_cm_Startup
m_objDTE = CType(application, DTE)
colCommandBars = CType(m_objDTE.CommandBars, CommandBars)
m_objCommandBar = colCommandBars.Add(Name:="Test", Position:=MsoBarPosition.msoBarTop, _
Temporary:=True)
objCommand = m_objDTE.Commands.Item("Help.About")
m_objCommandBarButton = CType(objCommand.AddControl(m_objCommandBar), CommandBarButton)
m_objCommandBarButton.Style = MsoButtonStyle.msoButtonCaption
m_objCommandBarButton.Visible = True
m_objCommandBar.Visible = True
End Select
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub
Public Sub OnDisconnection(ByVal disconnectMode As ext_DisconnectMode, ByRef custom As Array) _
Implements IDTExtensibility2.OnDisconnection
Try
If Not (m_objCommandBar Is Nothing) Then
m_objCommandBar.Delete()
End If
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub
Go back to the 'Resources for Visual Studio .NET extensibility' section for more articles like this
You can code, design, locate code and document your apps much faster using VB.NET, C#, C++ or Visual J#:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||