Which Statusbar Panel was clicked?

bjwade62

Centurion
Joined
Oct 31, 2003
Messages
104
This should be really easy but I can't figure out the .NET way of finding which Statusbar Panel was clicked?

Any help?
Thanks,
Bernie
 
Just use the value of the "sender" parameter in the event method:
C#:
if (sender is StatusBarPanel)
{
    MessageBox.Show( ((StatusBarPanel)sender).Name  + " was clicked..."); 
}
 
I'm not versed in C#. I'm using VB.NET. Thanks.

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..."); 
}
 
Code:
[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]
Once you wrap your head around the curly braces C# and VB are practically the same thing.
 
Back
Top