Results 1 to 3 of 3

Thread: [RESOLVED] Telling if a user has pressed the "enter" key

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2006
    Posts
    250

    Resolved [RESOLVED] Telling if a user has pressed the "enter" key

    Hi Everyone,

    How can I tell if a user pressed the "enter" key?

  2. #2
    Frenzied Member stimbo's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    1,739

    Re: Telling if a user has pressed the "enter" key

    You capture the event in the KeyDown or KeyPress event. Using a textbox as an example:
    1 Code:
    1. Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) _
    2.     Handles TextBox1.KeyDown
    3.  
    4.         If e.KeyCode = Keys.Enter Then
    5.  
    6.         End If
    7.  
    8.     End Sub
    Stim

    Free VB.NET Book Chapter
    Visual Basic 2005 Cookbook Sample Chapter

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jun 2006
    Posts
    250

    Re: Telling if a user has pressed the "enter" key

    thanks stimbo. that works perfectly.

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