Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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..."); 
}

  • Leaders
Posted

[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.

[sIGPIC]e[/sIGPIC]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...