I have two buttons on a windows form called btnOne and btnTwo.
When I click btnOne I want a messagebox to show
When I click btnTwo I want to run the btnOne click event to show the same messagebox. Does anyone know how to do this.
I have two buttons on a windows form called btnOne and btnTwo.
When I click btnOne I want a messagebox to show
When I click btnTwo I want to run the btnOne click event to show the same messagebox. Does anyone know how to do this.
command button question
ryanlcs
If you double click on a button in the design view, it adds an event handler. Inside the handler you can call MessageBox.Show. You can do the same for event two and just call the method for event 1, but you can also go into the properties for the button in the design view, click the lightning bolt to see events, and click the drop arrow for the click event and select the one you already created, so both buttons call the same event.
deval bhavsar
Private
Sub btnOne_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOne.ClickMsgBox(
"Here we are") End Sub Private Sub btnTwo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTwo.Click Me.btnOne.PerformClick() End SubMetroP
you can put message in a function.
Public
Class Form1 Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.ClickshowMessage()
End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ClickshowMessage()
End Sub Private Sub showMessage()MsgBox(
"hello") End SubEnd
Class