CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 1999
    Location
    India-Delhi
    Posts
    106

    How to get rid of TAB key

    Dear Friends,
    I am facing problems in varification of text / combo fields... I use enter key to check validation of data. I wish if your press TAB key then focus on control should remain there?
    Any idea...

    Any other idea in validation of data at the time of data entry in that control is also welcome
    Thanks in advance


  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: How to get rid of TAB key

    in VB 6 those controls come with a Validate event.
    You can trap it and set the Cancel argument to true.
    Then, the user won't be able to leave the field.


  3. #3
    Join Date
    Aug 1999
    Location
    India-Delhi
    Posts
    106

    Re: How to get rid of TAB key

    Hi,

    I tried, but could not get the appropriate results. It comes out from the control. Can you give some more clue and source code please...


  4. #4
    Guest

    Re: How to get rid of TAB key

    have you tried using the masked edit control. That comes with in-built properties of validation.


  5. #5
    Join Date
    May 1999
    Posts
    3,332

    Re: How to get rid of TAB key

    place a text box and a command button on an empty form.
    Then, in your form module place code like this:


    private Sub Text1_Validate(Cancel as Boolean)
    If Text1.Text = "" then
    MsgBox "please enter a value in this field"
    Cancel = true
    End If
    End Sub



    then, try clicking on the command button.
    It won't work if the text box is empty. It will work, if it is not empty.
    You won't be able to leave the field using tab or any other key if the field is empty.


  6. #6
    Guest

    Re: How to get rid of TAB key

    Check validation on a LOST FOCUS


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

Featured