0

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
Textbox1.Focus()
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

2
Contributors
2
Replies
4
Views
4 Years
Discussion Span
Last Post by Khav
1

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.

Votes + Comments
From Khav ..ty for help
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.