Hi Guys i need help on my school project.Currently i want to validate some important data in a textbox as soon as they are entered by the user
Here is my coding........

Private Sub Textbox1_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Textbox1_Leave
Call ValidateTextbox(Textbox1.Text) - Set saved = false if data is invalid and display error message
While saved <> True
End while

This works well but its not very user friendly.
1.After the error message is displayed , the pointer don't blink @textbox1(seems Focus not executing)
2.If i try to click on textbox , program will freeze and stop responding

Also tell me how can i make program respond only when eneter key is press(validate data only when user press enter)

Thanks for all
Peace and God bless you all:D

Try this

    Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
        'KeyDown switch

        Select Case e.KeyCode

            Case Keys.Enter

                'Is the textbox not null
                If TextBox1.Text <> Nothing Then

                    'EXECUTE INSTRUCTIONS

                End If

        End Select

    End Sub

If there's anything you want clarified just post a reply.

From Khav ..ty for help
This question has already been answered. Start a new discussion instead.