How To Call a Button Click From Another Button in c#

If there is a requirement for calling a button click event from another button in c#, there is a easy way to do.We just need to call the PerformClick Method of the button to be fired.

private void button1_Click(object sender, EventArgs e)
{
    button2.PerformClick();
}
 
private void button2_Click(object sender, EventArgs e)
{
    System.Windows.Forms.MessageBox.Show("I am called from button1");
}

Popularity: 10% [?]

Related posts:

  1. How to open an application, file Using Shell execute in .net
  2. Confirmation box in c# windows application
  3. Creating Excel as Datasource for Mail Merge using C#
  4. Make Textbox Number Only – WPF
  5. Mail Merge Using C#
You can leave a response, or trackback from your own site.

One Response to “How To Call a Button Click From Another Button in c#”

  1. prashant says:

    thank u so much…:)

Leave a Reply

Designed by: Business Web Hosting | Thanks to Buy Icons, travel tips and Used Cars