After exit text box, the cursor comes at the beginning of text box

tanha

Registered User.
Local time
Tomorrow, 02:07
Joined
Apr 9, 2007
Messages
80
Hello everybody,
I ristricted a text box, mean if it is not E-mail address format, then it prompts you, and is working well, but if you enter a non format of E-mail addreess, then after prompting, the cursor goes to the beginning of the text box, what I want the cursor comes after the written characters.
 

Attachments

Try:
Me.ControlName.SelStart = Len(Me.ControlName)
...using your ControlName of course.
 
Last edited:
Private Sub ValidateEmail()
If ActiveControl <> vbNullString Then
If InStr(1, ActiveControl, ".") = 0 Or InStr(1, ActiveControl, "@") = 0 Then
MsgBox "Email address not valid"
bNotValid = True
txtMail.SelStart = Len(txtMail.Value) ' < ADD this
End If
End If
End Sub
 
Thanks much both of you,
Yeah it is working well...
 

Users who are viewing this thread

Back
Top Bottom