bjwade62 Posted October 2, 2006 Posted October 2, 2006 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 Quote
Gill Bates Posted October 2, 2006 Posted October 2, 2006 Just use the value of the "sender" parameter in the event method:if (sender is StatusBarPanel) { MessageBox.Show( ((StatusBarPanel)sender).Name + " was clicked..."); } Quote
bjwade62 Posted October 2, 2006 Author Posted October 2, 2006 I'm not versed in C#. I'm using VB.NET. Thanks. Just use the value of the "sender" parameter in the event method:if (sender is StatusBarPanel) { MessageBox.Show( ((StatusBarPanel)sender).Name + " was clicked..."); } Quote
Leaders snarfblam Posted October 2, 2006 Leaders Posted October 2, 2006 [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. Quote [sIGPIC]e[/sIGPIC]
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.