VB .net question
Results 1 to 3 of 3

Thread: VB .net question

  1. #1
    Junior Member
    Join Date
    Aug 2004
    Posts
    25

    VB .net question

    I am writing my first VB .net program and want to know, how I can recognise when someone presses the return key when a specific text box has focus. As I want to execute some code when someone has entered some text in this text box and hit the return key.

    Thanx in advance,

    TTAYO

  2. #2
    Banned
    Join Date
    Nov 2005
    Posts
    63
    Code:
    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
       If e.KeyCode = Keys.Return Then
          MsgBox("detects that the return/enter has been pressed")
       End If
    End Sub
    pass in the right data, throw in a simple if statement, then execute whatever code you want.

  3. #3
    Junior Member
    Join Date
    Aug 2004
    Posts
    25
    Thanx for that!

    I know that it was a simple piece of code, as I could do it with VB6. But I haven't programmed in VB for about 3 years and I need to catch up and refresh my memory.

    L8R,

    TTAYO

Posting Permissions

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

 Security News

     Patches

       Security Trends

         How-To

           Buying Guides