Click to See Complete Forum and Search --> : How to get rid of TAB key


santulan
August 19th, 1999, 06:29 AM
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

Lothar Haensler
August 19th, 1999, 06:35 AM
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.

santulan
August 21st, 1999, 12:04 PM
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...

August 21st, 1999, 12:19 PM
have you tried using the masked edit control. That comes with in-built properties of validation.

Lothar Haensler
August 23rd, 1999, 02:16 AM
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.

March 2nd, 2000, 07:32 PM
Check validation on a LOST FOCUS