We help IT Professionals succeed at work.

How to put validation in textbox in Vb.net windows form,

searchsanjaysharma used Ask the Experts™
I have textbox, iwant user to enter date in dd/mm/yyyy format. with ease as it us windows application.
Textbox name is tdd,tmm,tyy.
1.I want the focus should automatically jumb to tmm when tdd is entered and so on.
2.Person should be able to press number only.
3.if user missed something, the alert should come.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
well thats all in the programming
i mean you can set the tab order to go from one box to another ( see google) enter tab order vb or help in vs

you can set the mask in the properties box also to only get numbers

to only enter number you do this in you keypress
    Private Sub txtCENumber_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtCENumber.KeyPress

        'celan out after first char digit entered
        If (Char.IsDigit(e.KeyChar)) Then
            If CleanAll = True Then
                ClearExcept = 3
                CleanAll = False
            End If
        End If
        If Not (Char.IsNumber(e.KeyChar) OrElse Char.IsControl(e.KeyChar) OrElse (AscW(e.KeyChar) = 8)) Then
            ' set CENumber textbox to accept only digits, the Backspace, the Tab, or the Enter key, nothing else
            e.Handled = True

        ElseIf (AscW(e.KeyChar) = 13) OrElse (AscW(e.KeyChar) = 9) Then
            'The field's not empty and Enter was pressed.
            ' Set the focus to the Search button so the Leave property do its magic
        End If

    End Sub
alerts are set in you leave routine
ie like this
If Len(PhoneCheck) <> 10 Then
                ' it's not a valid phone.  Warn user and exit sub
                MessageBox.Show("The telephone entered, " & txtTelePhone1.Text & " is not a 10 digit number." & vbCrLf & "Please try again.", _
                     "Phone Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)