Results 1 to 6 of 6

Thread: [RESOLVED] VB.NET to C# conversion

  1. #1

    Thread Starter
    Addicted Member cutamacious's Avatar
    Join Date
    May 2001
    Location
    INDIA >> Andhra Pradesh >> Hyderabad
    Posts
    185

    Resolved [RESOLVED] VB.NET to C# conversion

    this is vb.net code below


    VB Code:
    1. Private Sub TextBox1_Enter(ByVal sender As Object, ByVal e As System.EventArgs)
    2.                                                                Handles TextBox1.Enter
    3.  
    4. MsgBox(sender.Name)
    5.  
    6. End Sub

    how to do in c#.net
    Last edited by cutamacious; Jul 1st, 2005 at 04:59 AM. Reason: [Resolved]
    Cute Member

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091

    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

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

  4. #4
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    Re: VB.NET to C# conversion

    vb.net: sender.name

    c#: ((TextBox)(sender)).Name <---cast the sender

  5. #5

    Thread Starter
    Addicted Member cutamacious's Avatar
    Join Date
    May 2001
    Location
    INDIA >> Andhra Pradesh >> Hyderabad
    Posts
    185

    Re: VB.NET to C# conversion

    Quote 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



    VB Code:
    1. Msgbox (sender.Name)
    Cute Member

  6. #6
    Addicted Member
    Join Date
    Mar 2001
    Location
    India
    Posts
    134

    Re: VB.NET to C# conversion

    Quote Originally Posted by cutamacious
    Building this statement gives that 'object' doesnot contain definition for 'Name'

    whereas in VB it works fine when i give



    VB Code:
    1. Msgbox (sender.Name)

    Well !!! I guess u missed out the braces count. Just verify that the code should be

    MessageBox.show ( ( (Textbox)(sender) ) . Name )
    Pavan Kumar

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width