Linking a ToolStripMenuItem  
Author Message
Didde





PostPosted: Visual Basic Express Edition, Linking a ToolStripMenuItem Top

Hi!

I want to link an ToolStripMenuItem when I click it to another form so that my "Form2" will show up. Code examples



Visual Studio Express Editions25  
 
 
Brendan Grant





PostPosted: Visual Basic Express Edition, Linking a ToolStripMenuItem Top

You simply need to create an event handler that executes when the menu’s click event is fired and it is generally as simple as:

Private Sub SomeToolStripMenuItemToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SomeToolStripMenuItemToolStripMenuItem.Click
Dim form As New Form2
form.Show()
End Sub

Where SomeToolStripMenuItemToolStripMenuItem is the name (overly long in my case) of the ToolStripMenuItem that has been clicked on.

Inside of this function we simply create a reference to a new form2 object and show it.

Does this work for you