|
-
Jun 30th, 2005, 07:01 AM
#1
Thread Starter
Addicted Member
[RESOLVED] VB.NET to C# conversion
this is vb.net code below
VB Code:
Private Sub TextBox1_Enter(ByVal sender As Object, ByVal e As System.EventArgs)
Handles TextBox1.Enter
MsgBox(sender.Name)
End Sub
how to do in c#.net
Last edited by cutamacious; Jul 1st, 2005 at 04:59 AM.
Reason: [Resolved]
Cute Member 
-
Jun 30th, 2005, 07:30 AM
#2
Re: VB.NET to C# conversion
Code:
//At some point in the load of your form, or the InitializeComponent, or whatever
TextBox1.Enter += new System.EventHandler(TextBox1_Enter);
//Then your handler proc
private void TextBox1_Enter(Object sender, System.EventArgs e) {
//Code
}
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Jun 30th, 2005, 07:43 AM
#3
Re: VB.NET to C# conversion
-
Jun 30th, 2005, 08:20 PM
#4
Re: VB.NET to C# conversion
vb.net: sender.name
c#: ((TextBox)(sender)).Name <---cast the sender
-
Jun 30th, 2005, 11:51 PM
#5
Thread Starter
Addicted Member
Re: VB.NET to C# conversion
 Originally Posted by mar_zim
vb.net: sender.name
c#: ((TextBox)(sender)).Name <---cast the sender
Building this statement gives that 'object' doesnot contain definition for 'Name'
whereas in VB it works fine when i give
Cute Member 
-
Jun 30th, 2005, 11:55 PM
#6
Addicted Member
Re: VB.NET to C# conversion
 Originally Posted by cutamacious
Building this statement gives that 'object' doesnot contain definition for 'Name'
whereas in VB it works fine when i give

Well !!! I guess u missed out the braces count. Just verify that the code should be
MessageBox.show ( ( (Textbox)(sender) ) . Name )
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|