0

i'm just wondering what the difference is between Control.OnClick and Control.InvokeOnClick methods.

the second thing i wonder ise, when it is asp.net they talk about 3 componenets: Click event, OnClick method, and button1_click eventhandler. but when it is desktop appcliatons they talk about only 2 componenets, Click event and its eventhandler. why is the onclik(invokeonclick) not mentioned at all?

Volkan Yurtseven
  • 425
  • 3
  • 15

1 Answers1

1

OnClick allows you to add a handler for when the Click event occurs on the control. InvokeOnClick will "Raise the Click event for the specified control".

So if you have assigned a handler to OnClick and then call InvokeOnClick on that control then your handler will be called.

Web is different. This answer may help you for invoking click on a 'web' button.

wallismark
  • 1,766
  • 2
  • 21
  • 35
  • there is also PerformClick. i'm totally confused. – Volkan Yurtseven Jul 06 '17 at 17:34
  • this answer might help with Perform vs Invoke (scroll down to Jcl answer) https://stackoverflow.com/questions/35345551/what-conditions-prevent-performclick-from-working-but-allow-invokeonclick-to-wor – wallismark Jul 07 '17 at 03:00