It is good programming practice not to put code inside an object event - for example, a click event. Instead, you should put the code in your own methods that are called by the click event. Then, when you need to start a whole bunch, you do not need to trigger a click event for each button, but instead run each of the methods that will trigger direct call events.
Private Sub DoSomething()
'Code to do something
End Sub
Private Sub DoSomethingElse()
'Code to do something else
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs)
DoSomething
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs)
DoSomethingElse
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs)
DoSomething
DoSomethingElse
End Sub
It also makes much more verifiable code ... not the code that is especially tested inside a Microsoft Office application. But this is a common industry practice.
source
share