Call a button's code

  • Thread starter Thread starter Amjad
  • Start date Start date
Just invoke the method that handles the click event of the other button:

Button1_Click(Button2, EventArgs.Empty)
 
Hi Amjad,

Quit simple

If you are in the clickeventButtonA

Then clickeventButtonB(sender, e)

That is all

Cor
 
Just invoke the method that handles the click event of the other button:

Button1_Click(Button2, EventArgs.Empty)

Better would be Button1.PerformClick. Or better yet, move the code in
Button1's handler to a separate sub so you can call that from both places.
 
Back
Top