473,507 Members | 2,377 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

focus problem

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.
Nov 21 '05 #1
4 1540
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

"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:e%****************@TK2MSFTNGP10.phx.gbl...
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.

Nov 21 '05 #2
Hi,
For the cancel button set its causesvalidation property to
false. This will prevent the validated event from being fired.

Ken
------------------
"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:e%****************@TK2MSFTNGP10.phx.gbl...
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.

Nov 21 '05 #3
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
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> ¦b¶l¥ó
news:e2**************@TK2MSFTNGP11.phx.gbl ¤¤¼¶¼g...
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

"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:e%****************@TK2MSFTNGP10.phx.gbl...
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.


Nov 21 '05 #4
Sorry for my silly mistakes, I solve my problem

"Agnes" <ag***@dynamictech.com.hk> ¦b¶l¥ó
news:OF**************@TK2MSFTNGP10.phx.gbl ¤¤¼¶¼g...
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
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> ¦b¶l¥ó
news:e2**************@TK2MSFTNGP11.phx.gbl ¤¤¼¶¼g...
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

"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:e%****************@TK2MSFTNGP10.phx.gbl...
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.



Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2606
by: Dai Ba Wong | last post by:
Hi: Currently I am having a problem with my webpage. My page consist of two frames, one consist of input text field and the other contains link for different pop-up windows. The problem...
2
3077
by: Peter Wright | last post by:
Hi all. Hopefully this should demonstrate the problem I'm having: http://flooble.net/~pete/focus-problem-demo/ (I'm testing it in Mozilla only, but I'm not sure if it's actually a...
2
1995
by: Jesper | last post by:
Last week I posted this for the first time. However, I didn't get any useable solution to my problem. I'm very keen on getting this problem solved, so please excuse me for trying again. I'll try to...
1
2224
by: avnrao | last post by:
Hi, I am facing a problem with control.focus (javascript). Here is the description of the issue. 1. I have 2 aspx files. on Aspx1 I have button named NewRow. Clicking on this, will redirect...
4
3926
by: SJ | last post by:
Hi all, I have come across a weird problem when attempting to automatically set the focus in a vb.net form to a checkbox control... In my form I have (on a tab page in a tab control) several...
1
5125
by: clickon | last post by:
For testing purposes i have got a 2 step WizardControl. Eqach step contains a text box, TextBox1 and TextBox2 respectively. If i put the following code in the respective activate event handlers for...
11
7320
by: Alex.Svetos | last post by:
Hello, I'm trying to get a popup to keep focus when it is re-clicked. The script below is supposed to produce this exact behaviour, however it doesn't work, at least on firefox 1.0.7 and moz...
7
11902
by: Dave Booker | last post by:
I am using a WebBrowser object in my .NET 2.0 application, but it is not shown to the user. Every time a timer event triggers it to perform a m_WebBrowser.Navigate() I get that classic IE 'click'...
3
4232
by: jan.loucka | last post by:
Hi, I looked around for this specific problem but could not find any answer - there's few things in VB but still nothing exactly like this so I'd appreciate any help. We're writing C# WinForm...
2
2462
by: Jonathan N. Little | last post by:
As part of a JavaScript precheck form validation I noticed a problem with trying to return focus to the field with an error. I have setup a demo page. ...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7319
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7031
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7485
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1542
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
760
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
412
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.