How To Call a Button Click From Another Button in C#.Net?

InfoPath alternatives for form designing SharePoint

In this post we will discuss about how we can call a button click from another button click in C#.Net. Remember this is available in windows application not in web application.

You can also check my previous posts on Encrypt and Decrypt a file in C#.Net, What is Automation Testing? and Add property to class in C#.Net.

It is easy to call a button click on another button click. Check the full code below:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void btnFirst_Click(object sender, EventArgs e)
{
lblResult.Text = “This is the First Button!”;
}

private void btnSecond_Click(object sender, EventArgs e)
{
btnFirst.PerformClick();
}
}
}

Here in the second button click event we are calling the first button click and the result will be shown as “This is the First Button!”. Check the figure for output.

Similar SharePoint 2013 Tutorials


About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →

Leave a Reply