Results 1 to 4 of 4

Thread: Simple but iritating

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 1999
    Location
    Perth, WA
    Posts
    35

    Cool

    I know this is a simple thing to do but I cant for the lie of me remember how to catch an "Enter" in a text field.

    if anyone has the time, pls post an example for this so i can finish my program

    help for any thanks >

  2. #2
    Guest

    I had this problem once

    Check out the KeyPress and KeyDown events of the textbox, and then use the code for an Enter key (which i think is vbKeyEnter, not sure though). If you open up the Objects browser in VB, there is a list of constants like this.

    or failing that, you could always use a command button with its Default property set to true (you could hide it under the text box if you wanted.

  3. #3
    Fanatic Member
    Join Date
    Apr 2000
    Location
    Whats a location?
    Posts
    516

    Wink

    It's vbKeyReturn
    Courgettes.

  4. #4
    Fanatic Member
    Join Date
    Apr 2000
    Location
    Whats a location?
    Posts
    516

    ...

    Here's the code (I think)

    Code:
    Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyReturn Then
        'Do your code here
    End If
    End Sub
    Courgettes.

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