.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Why doesn't the menu unload definitively

0 REPLIES 0
Reply
Message 1 of 1
as
194 Views, 0 Replies

Why doesn't the menu unload definitively

I have writen a routine that unloads a menugroup.

Code :
Friend Function UnLoad_Menu(ByVal MenuName As String) As Integer
Dim acadApp As AcadApplication
Dim acadDoc As AcadDocument
Dim curUCS As AcadUCS
Dim ReturnValue As Integer = 0

Try
acadApp = CType(Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication, AcadApplication)
acadApp.Visible = True
acadDoc = acadApp.ActiveDocument
acadDoc.Application.Visible = True

Dim MenuGroepen As AcadMenuGroups
Dim MenuGroep As AcadMenuGroup
MenuGroepen = acadApp.MenuGroups
'MenuGroepen = acadDoc.Application.MenuGroups
MenuName = Mid(MenuName, InStrRev(MenuName, "\") + 1)

For Each MenuGroep In MenuGroepen
Dim MenuGroepNaam As String = Mid(MenuGroep.MenuFileName, InStrRev(MenuGroep.MenuFileName, "\") + 1)
If MenuGroepNaam.ToUpper = MenuName.ToUpper Then
MenuGroep.Unload()
ReturnValue = 1
End If
Next
acadDoc.Activate()
acadApp.Update()

Return ReturnValue

Catch ex As Exception
MessageBox.Show("Unloading Toolbar" & vbCrLf & ex.ToString)
Return 2

End Try
End Function

If i run the routine it will unload the menugroup, and if you look ik the customize part it isnot there anymore. But when i restart Autocad it does come back until i unload it manualy. What is wrong, I can't find it out.

Can anybody help me. C# is not a problem to me, I can convert it.

With kind regards,

Harold van Aarsen
0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost