I'm trying to execute a command when a Form was opened, but the command is not executed, can someone help me?
Code:
Private Sub MenuPrincipal_Load(sender As Object, e As EventArgs)
MessageBox.Show("You answered yes, yes and no.")
End Sub
I'm trying to execute a command when a Form was opened, but the command is not executed, can someone help me?
Code:
Private Sub MenuPrincipal_Load(sender As Object, e As EventArgs)
MessageBox.Show("You answered yes, yes and no.")
End Sub
Unless you have an AddHandler
somewhere we can't see, you should declare that your Sub handles the event:
Private Sub MenuPrincipal_Load(sender As Object, e As EventArgs) Handles MyBase.Load
^^^^^^^^^^^^^^^^^^^
...
You want to use a command when the form opens. Then put the command in Formload , in the example i use Form2 .
Make a Private Sub and then put the name in Load. Don't know what form you are using but changing is not so hard.
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
MenuPrincipal()
End Sub
Private Sub MenuPrincipal()
MessageBox.Show("You answered yes, yes and no.")
End Sub