"asr" <an*******@discussions.microsoft.com> wrote in news:0ba901c3a1f8
$5****************@phx.gbl:
I've a form with a button on it.
How to raise (I mean to run the code within the click
event of the button) without clicking the button?
Is it possible to raise the events programatically.
You can only raise an event from within the class itself (or a derived
class).
If you have a common method that should be run both on the click of a
button and some other instance, then put all that code within a new method.
You can call that method from both the click event and your other method...
===================================
private void Button1_Click(...)
{
SharedClickLogic();
}
private void YourOtherMethod(...)
{
SharedClickLogic();
}
private void SharedClickLogic()
{
//do stuff here
}
===================================
Michael Lang