Visual Basic Form Validations
Hi,
How do i set the focus back onto a textbox
eg : I am using the following code in my Visual Basic project
If IsNumeric(txtJobCode.Text) Then
If txtJobCode.Text < 100 Or txtJobCode.Text > 174 Then
MsgBox "Please enter a number for JOBCODE between 100 and 174 only."
txtJobCode.SetFocus
End If
End If
I do get the message box but i never get the setfocus back onto the textbox
Please Help,
New to Visual basic.
PS : This is not VBScript in html but i am working on a visual basic project. ;)
Re: Visual Basic Form Validations
i think ur code is perfect the problem may be u may have more codes after this set in the same procedure so u have to say exit sub after setting the focus so the procedure stops there. iam sending u the corrected code okay. also tell me where r u writing this code in which event(is it lostfocus of the text box)
If IsNumeric(txtJobCode.Text) Then
If txtJobCode.Text < 100 Or txtJobCode.Text > 174 Then
MsgBox "Please enter a number for JOBCODE between 100 and 174 only."
txtJobCode.SetFocus
exit sub
End If
End If
Re: Visual Basic Form Validations
I no i have the same problem, this might help make it focused:
txtJobCode.text = ""