Guys, Does anyone know if something like this is possible in C#:
private void ButtonClick(object sender, EventArgs e) { switch(true){ case (sender == btn1): ... break; case (sender == btn2): ... break; case (sender == btn3): ... break; } I've looked at sample code and read up on the switch statement and it appears to be unavailable. Why is that? If C# is modern language, why does it not have some very simple abilities that VB has had? It seems that if you want to have one procedure handle the click events for several buttons, that doing it this way is harder to read: ... if (sender == btn1){ ... }else if (sender == btn2){ ... }else if (sender == btn3){ ... } ... Thanks, Mike =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com