Results 1 to 7 of 7

Thread: KeyPress [Enter]

  1. #1

    Thread Starter
    Lively Member moe222's Avatar
    Join Date
    Sep 2003
    Location
    Canada
    Posts
    68

    KeyPress [Enter]

    Hey,

    How can I make it so that when you hit enter when your typing in a text box that it unloads the form? thx
    Moe

  2. #2

  3. #3
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429
    Like:
    VB Code:
    1. Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
    2.     If KeyCode = vbKeyReturn Then Unload Me
    3. End Sub


    Maybe he is unloading cause the user has done what they should


    Bruce.

  4. #4
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    Originally posted by Bruce Fox
    Like:
    VB Code:
    1. Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
    2.     If KeyCode = vbKeyReturn Then Unload Me
    3. End Sub


    Maybe he is unloading cause the user has done what they should


    Bruce.
    That certainly wouldn't be one of the standard ways of doing it.

  5. #5
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429
    Here is a potential use.

    A (custom made) password dialog (Form). If after entering the correct password
    the user hits Return, (being valid) the form could disapear (remain if password incorrect). Maybe

  6. #6
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780
    Just for an afterthought you can set a command button to be a default OK button. When you press enter anywhere on the form, it will in effect click the button. You can also use a Cancel property to do the same with the Esc key.

  7. #7

    Thread Starter
    Lively Member moe222's Avatar
    Join Date
    Sep 2003
    Location
    Canada
    Posts
    68
    lol, My program is a browser and when enter is pressed the url in a text box loads the web thingy and so on...i just used unload cuz i didnt have time to say web.navigate = "url"

    Thx
    Moe

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