Results 1 to 9 of 9

Thread: [RESOLVED] Key Tab Problem

  1. #1

    Thread Starter
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036

    Resolved [RESOLVED] Key Tab Problem

    Hi.
    I have a form with 4 textboxes. I want to do validation from text3 to text4.
    I've tried to use KeyDown, KeyUp and KeyPress but my problem is that none of them fires with TAB Key !? It passes focus to text4, i don't want that.

    Any suggestion, what the API function to hook the keyboard?
    Regards
    Jorge
    "The dark side clouds everything. Impossible to see the future is."

  2. #2

  3. #3

    Thread Starter
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036

    Re: Key Tab Problem

    Unfortunetly there's no validade event in vb 5.
    Regards
    Jorge
    "The dark side clouds everything. Impossible to see the future is."

  4. #4

  5. #5

    Thread Starter
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036

    Re: Key Tab Problem

    I've tried it , but when i pressed keyenter on text3 keydown event the lostfocus is fired too.
    Jorge
    "The dark side clouds everything. Impossible to see the future is."

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Key Tab Problem

    Quote Originally Posted by Asgorath
    Hi.
    I have a form with 4 textboxes. I want to do validation from text3 to text4.
    I've tried to use KeyDown, KeyUp and KeyPress but my problem is that none
    What kind of validation are you looking to do?

  7. #7

    Thread Starter
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036

    Re: Key Tab Problem

    When i press the key Enter on Text3 i display a modal form that define a variable and closes itself. I don't want the TAB key to be 'enabled' if the variable is empty.

    Anyway GetAsyncKeyState might do the trick.
    Jorge
    "The dark side clouds everything. Impossible to see the future is."

  8. #8
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Key Tab Problem

    How about doing something like this? Add a timer and set the interval to something low like 10:
    VB Code:
    1. Private Sub Text3_LostFocus()
    2.     Timer1.Enabled = True
    3. End Sub
    4.  
    5. Private Sub Text4_GotFocus()
    6.     If Timer1.Enabled Then
    7.         ' Validate It
    8.         Debug.Print "Validate: " & Text1.Text
    9.     End If
    10. End Sub
    11.  
    12. Private Sub Timer1_Timer()
    13.     Timer1.Enabled = False
    14. End Sub
    Avoids the need for API.

  9. #9

    Thread Starter
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036

    Re: Key Tab Problem

    Ok, i'd forgotten about the gotfocus event, thanks it working now.
    Jorge
    "The dark side clouds everything. Impossible to see the future is."

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