Consider:
private void ButtonClick(object sender, EventArgs e)
{
Console.WriteLine("Button Click Event Fired");
}
Obviously, you could wire this up to a single button's click event without a problem. However, I think what you want to know is how can you use one method to handle the events from many buttons (or other controls). In that case you could do soemthing like this:
private void ButtonClick(object sender, EventArgs e)
{
Button b = (Button)sender;
switch(b.ID)
{
case "button1":
b.Enabled = false;
break;
case "button2":
b.Enabled = true;
break;
case "button3":
b.Enabled = true;
break;
}
}
hth.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor :.
Wrox Books 24 x 7
================================================== =========