You can write whatever you want to do inside a click in another function, and call it from within the click handler or programmatically, like this -
public void Form1_Load(object s, EventArgs e)
{
PerformClickAction();
}
void button_click(object sender,EventArgs e)
{
PerformClickAction();
}
void PerformClickAction()
{
}
source
share