Results 1 to 3 of 3

Thread: validation on tab

  1. #1

    Thread Starter
    Lively Member nutstretch's Avatar
    Join Date
    May 2000
    Location
    UK
    Posts
    85

    Question

    Hi I have been struggling with this for a few weeks now all suggestions do not seem to work. I am writing a program which validates well on the return key but as many users especially experienced one like to use tab and therefore go though my program with no validation, i want to validate on tab too or disable it. I have tried the keyascii for tab which is 9 but this does not seem to work. I have tried validation on a lost focus but just got into a messagebox hell with everytime you left a box with nothing in it threw up a messagebox good butwhen you tried to set the focus back to the original text box you got another lostfocus empty box messagebox from the one it had just left. I have tried vbtab but thast did noty seem to work and tried chr(9) with no success. Please oh people with brains and exquisit knowledge help me out here

    nuts
    if at first you don't succeed, drink the rest of the bottle and loop to the same place tomorrow

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    Unfortunately here is how the Tab key works. If there is only one control on a form with TabStop = True, the Tab key will be recognized and you can check for it, but if there is more than one you can't check for it. What you need to do is this:
    1) In the form's Load event, store the TabStop values for all the controls that you are interested in
    2) Then in the GotFocus even of each control set the TabStop property of all other controls to False (you could write a subroutine to do this)
    3) And then in the LostFocus event set the TabStop values of all the controls back to their originally stored values.

  3. #3

    Thread Starter
    Lively Member nutstretch's Avatar
    Join Date
    May 2000
    Location
    UK
    Posts
    85
    many thanks MartinLiss i will do that

    nuts

    breathing easier again
    if at first you don't succeed, drink the rest of the bottle and loop to the same place tomorrow

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