I am having trouble trying to open a form using a menu strip
I have tried adding a message box to see if its just a form however when trying this wont open neither
If DocumentCenterToolStripMenuItem.Selected = True Then
MessageBox.Show("Testing", "Important Message")
End If
Double click on your menu item in the winforms designer. This creates a Click
event handler in your form code.
Private Sub DocumentCenterToolStripMenuItem_Click(sender As Object, e As EventArgs) _
Handles TestToolStripMenuItem.Click
MessageBox.Show("Testing", "Important Message")
End Sub
Winforms applications are event driven. I.e., normally they are waiting for input. When you type a key or activate the mouse, events are risen. You can handle these events with event handler methods. Once such a method has terminated, the application is waiting again. They are like other methods but have a Handles
keyword followed by the event designation.
Normally, you can not ask whether the menu item is selected with If DocumentCenterToolStripMenuItem.Selected = True Then
, as probably this code is not even running, or when it is running, then probably the user is not clicking this menu item at this exact moment.