Hi Matthew,
After reading your second reply, I think a dynamical MainMenu will be a
solution.
In the Form_Load event if MDI form, you can hide the menu item so that it
will not be found.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
' Create the MainMenu and the menu items to add.
Dim mainMenu1 As New MainMenu
Dim menuItem1 As New MenuItem
Dim menuItem2 As New MenuItem
Dim subMenuItem1 As New MenuItem
' Set the caption for the menu items.
menuItem1.Text = "File"
menuItem2.Text = "Edit"
'Add an subMenuItem and add its event handler
subMenuItem1.Text = "Test"
AddHandler subMenuItem1.Click, AddressOf m_Click
' Add 3 menu items to the MainMenu for displaying.
mainMenu1.MenuItems.Add(menuItem1)
mainMenu1.MenuItems.Add(menuItem2)
menuItem1.MenuItems.Add(subMenuItem1)
' Assign mainMenu1 to the form.
Menu = mainMenu1
'So that the sencond menu item will not found in the menu bar.
Menu.MenuItems(1).Visible = False
End Sub
Private Sub m_Click(ByVal sender As Object, ByVal e As System.EventArgs)
MsgBox("hello")
End Sub
If you have any concern on this issue, please feel free to post here.
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.