Sunday, 22 August 2010

to identify whic contoll is clicked


//to identify whic contoll is clicked
//create sush a form as shown in fig
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 WindowsProject
{
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
}
private void button_Click(object sender, EventArgs e)
{
//Button b = (Button)sender;
Button b = sender as Button;
if (b.Name == "button1")
MessageBox.Show("Button1 is clicked");
else if (b.Name == "button2")
MessageBox.Show("Button2 is clicked");
else if (b.Name == "button3")
MessageBox.Show("Button3 is clicked");
}
private void Form3_Load(object sender, EventArgs e)
{
}
}
}