473,387 Members | 1,897 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 1536
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
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
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
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
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
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
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
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
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
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
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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...

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.