running32
asked on
Validate Masked Input Text Box
How do I validate to see if a value has been entered into a masked input box.
Thanks
If txtDOB.CtlText = "" Then
MsgBox("Please enter DOB")
txtDOB.Focus()
Exit Sub
End If
Thanks
If txtDOB.CtlText = "" Then
MsgBox("Please enter DOB")
txtDOB.Focus()
Exit Sub
End If
Regular expression validation.
Bob
Bob
ASKER
Thanks guys
ASKER
Sorry I hit enter too quickly.
Regular validation does not work. Even when I enter a value I get the msgbox.
If txtDOB.Text = "" Then
MsgBox("Please enter DOB")
txtDOB.Focus()
Exit Sub
End If
and I would rather not use a datetime picker control. Thanks for the input
Regular validation does not work. Even when I enter a value I get the msgbox.
If txtDOB.Text = "" Then
MsgBox("Please enter DOB")
txtDOB.Focus()
Exit Sub
End If
and I would rather not use a datetime picker control. Thanks for the input
what about the mask edit control ?
ASKER
I wanted to validate that there is actually a value in the text box before I proceed. My problem is that because it is masked I'm not sure how to test.
ASKER
I tried this below and I can see the string as 08/17/1975 but it does not reconize there are # there
Dim instrdob As Integer
instrdob = InStr(1, txtDOB.CtlText, "[0-9]", CompareMethod.Text)
If instrdob = 0 Then
MsgBox("Please enter DOB")
txtDOB.Focus()
Exit Sub
End If
Dim instrdob As Integer
instrdob = InStr(1, txtDOB.CtlText, "[0-9]", CompareMethod.Text)
If instrdob = 0 Then
MsgBox("Please enter DOB")
txtDOB.Focus()
Exit Sub
End If
You are already using a masked edit control! Which one is it?
I suppose that the CtlText property you are using gives you the prompts characters (/-_ ...). You must have another property that exclude them (this property is different from each control). Add you control to the Watch window while it as no value in it and check to see which property as the raw value in it.
I suppose that the CtlText property you are using gives you the prompts characters (/-_ ...). You must have another property that exclude them (this property is different from each control). Add you control to the Watch window while it as no value in it and check to see which property as the raw value in it.
ASKER
I'm new to vb.net. I'm using the Masked EditControl Version 6.0 if that helps any. In the mask session I put ##/##/####.
I'm not sure how to add the control to the Watch window. But if I display a message box I get back __/___/____ and the value count is always 10.
Thanks
I'm not sure how to add the control to the Watch window. But if I display a message box I get back __/___/____ and the value count is always 10.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ClipText it is. Thank you.
For other mask, see http://www.codeproject.com/vb/net/cpflexmaskeditbox.asp