Call event in another event
-
Hi, How can I call one event in another event, like I want to call form click event into form load. what should i do for this issue. Please do replay
-
Hi, How can I call one event in another event, like I want to call form click event into form load. what should i do for this issue. Please do replay
You can replay a cd, not a post :). But to call events like you would like, you have to call it just like a function:
public void Button1_Clicked(object sender, EventArgs e)
{
//do some stuff//do some stuff the same as button2
Button2_Clicked(sender, e);
}public void Button2_Clicked(object sender, EventArgs e)
{
//do some stuff
}To be honest: this is not really neat. To make it more beautifull, you should just make a function like this:
public void Button1_Clicked(object sender, EventArgs e)
{
//do some stuff//do some stuff the same as button2
doStuffFromButton2();
}public void Button2_Clicked(object sender, EventArgs e)
{
//do some stuff
doStuffFromButton2();
}public void doStuffFromButton2()
{
//do some stuff
}