Reloading my AddIn with custom Panel causes Error

Reloading my AddIn with custom Panel causes Error

striebel.sebastian
Explorer Explorer
471 Views
1 Reply
Message 1 of 2

Reloading my AddIn with custom Panel causes Error

striebel.sebastian
Explorer
Explorer

Hello,

I´ve created a VB.NET AddIn that works as intended, but when I manually reload it, I get an unidentified Error.

 

Public Sub Activate([...])
            [...]
            If firstTime Then 
                AddToUserInterface()
            End If
End Sub

Private Sub AddToUserInterface()
            ' Get the drawing ribbon.
            Dim drawingRibbon As Ribbon = g_inventorApplication.UserInterfaceManager.Ribbons.Item("Drawing")
            ' Get the "Place Views" tab.
            Dim PlaceViewsTab As RibbonTab = drawingRibbon.RibbonTabs.Item("id_TabPlaceViews")
            ' Create a new panel.
            Dim PrintAddInPanel As RibbonPanel = PlaceViewsTab.RibbonPanels.Add("Print Service", "PrintAddInPanel", AddInClientID)

            ' Add buttons to Ribbon Panel.
            PrintAddInPanel.CommandControls.AddButton(m_Print_PDF, False, True)
[...]
End Sub

I get the Error the line where I add my custom RibbonPanel.

What code do I need to add to make it work?
Do I need something in the Deactivate() Sub?

Thanks in advance.

0 Likes
Accepted solutions (1)
472 Views
1 Reply
Reply (1)
Message 2 of 2

striebel.sebastian
Explorer
Explorer
Accepted solution

Never mind.

I figured it out by myself. Just add this to your code and everything works just fine.

Public Sub Deactivate() Implements Inventor.ApplicationAddInServer.Deactivate
     PrintAddInPanel.Delete()
End Sub

 

0 Likes