focus problem

  • Thread starter Thread starter Agnes
  • Start date Start date
A

Agnes

I want do some checking in Textbox's validated event. If the user input the
wrong code, I would like to set the focus on that textbox, HOWEVER, if the
user click 'cancel button ' or use 'Next arrow' or 'up arrow' to move
another place, I need to let the user to that .
in vb.net I got no idea on this . Anyone got idea ?
Thank in advance.
 
Hi,


For the cancel button set its causesvalidation property to
false. This will prevent the validated event from being fired.

Ken
------------------
I want do some checking in Textbox's validated event. If the user input the
wrong code, I would like to set the focus on that textbox, HOWEVER, if the
user click 'cancel button ' or use 'Next arrow' or 'up arrow' to move
another place, I need to let the user to that .
in vb.net I got no idea on this . Anyone got idea ?
Thank in advance.
 
Private Sub TextBox2_Validating(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles TextBox2.Validating

Dim tBox As TextBox = DirectCast(sender, TextBox)

'Your validation code goes here.

If (tBox.Text = "ok") Then

e.Cancel = False

Else

e.Cancel = True

End If

End Sub


--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing
 
To OHM, I am sorry that I don't understand your code , How can I apply it in
the cancel button ??
To Ken, I am sorry that I try your method, but it didn't work.

From Agnes
 
Sorry for my silly mistakes, I solve my problem

Agnes said:
To OHM, I am sorry that I don't understand your code , How can I apply it in
the cancel button ??
To Ken, I am sorry that I try your method, but it didn't work.

From Agnes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top