I have fooled around with this for 3 days now and it's time to ask.
How do you reference a menu item in code?
'Create the ComponentMenu object
Private objComponentMenu As MenuItem
'Create the main "Messages" menu item
objComponentMenu = New MenuItem("&Component")
'Create another new "Menuxx" menu item
'Add an event handler to handle the user's clicking on the menu item.
Dim mnuMenu1 As New MenuItem("Menu01", New System.EventHandler(AddressOf Me.ComponentMenuHandler))
'Add the menu item to the "Component" menu item
objComponentMenu.MenuItems.Add(mnuMenu1)
Dim mnuMenu2 As New MenuItem("Menu02", New System.EventHandler(AddressOf Me.ComponentMenuHandler))
'Add the menu item to the "Component" menu item
objComponentMenu.MenuItems.Add(mnuMenu2)
'My menu handler
Protected Sub ComponentMenuHandler(ByVal sender As Object, ByVal e As System.EventArgs)
Select Case ????
Ok so what do I switch on? It can't be the index, it changes. It can't be the menu text, it changes.
End Select
End Sub
Help please.
How do you reference a menu item in code?
'Create the ComponentMenu object
Private objComponentMenu As MenuItem
'Create the main "Messages" menu item
objComponentMenu = New MenuItem("&Component")
'Create another new "Menuxx" menu item
'Add an event handler to handle the user's clicking on the menu item.
Dim mnuMenu1 As New MenuItem("Menu01", New System.EventHandler(AddressOf Me.ComponentMenuHandler))
'Add the menu item to the "Component" menu item
objComponentMenu.MenuItems.Add(mnuMenu1)
Dim mnuMenu2 As New MenuItem("Menu02", New System.EventHandler(AddressOf Me.ComponentMenuHandler))
'Add the menu item to the "Component" menu item
objComponentMenu.MenuItems.Add(mnuMenu2)
'My menu handler
Protected Sub ComponentMenuHandler(ByVal sender As Object, ByVal e As System.EventArgs)
Select Case ????
Ok so what do I switch on? It can't be the index, it changes. It can't be the menu text, it changes.
End Select
End Sub
Help please.