if (sender is StatusBarPanel)
{
MessageBox.Show( ((StatusBarPanel)sender).Name + " was clicked...");
}
Gill Bates said:Just use the value of the "sender" parameter in the event method:C#:if (sender is StatusBarPanel) { MessageBox.Show( ((StatusBarPanel)sender).Name + " was clicked..."); }
[color=blue]if[/color] (sender [color=blue]is[/color] StatusBarPanel) {
[color=red]becomes...[/color]
[color=blue]If Typeof[/color] sender [color=blue]Is[/color] StatusBarPanel [color=blue]Then[/color]
MessageBox.Show( ((StatusBarPanel)sender).Name + " was clicked...");
[color=red]becomes...[/color]
MessageBox.Show( [color=blue]DirectCast[/color](sender, StatusBarPanel).Name + "was clicked...")
}
[color=red]becomes...[/color]
[color=blue]End If[/color]