473,662 Members | 2,575 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 1555
Private Sub TextBox2_Valida ting(ByVal sender As Object, ByVal e As
System.Componen tModel.CancelEv entArgs) Handles TextBox2.Valida ting

Dim tBox As TextBox = DirectCast(send er, 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***@dynamict ech.com.hk> wrote in message
news:e%******** ********@TK2MSF TNGP10.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 causesvalidatio n property to
false. This will prevent the validated event from being fired.

Ken
------------------
"Agnes" <ag***@dynamict ech.com.hk> wrote in message
news:e%******** ********@TK2MSF TNGP10.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******** ******@TK2MSFTN GP11.phx.gbl ¤¤¼¶¼g...
Private Sub TextBox2_Valida ting(ByVal sender As Object, ByVal e As
System.Componen tModel.CancelEv entArgs) Handles TextBox2.Valida ting

Dim tBox As TextBox = DirectCast(send er, 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***@dynamict ech.com.hk> wrote in message
news:e%******** ********@TK2MSF TNGP10.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***@dynamict ech.com.hk> ¦b¶l¥ó
news:OF******** ******@TK2MSFTN GP10.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******** ******@TK2MSFTN GP11.phx.gbl ¤¤¼¶¼g...
Private Sub TextBox2_Valida ting(ByVal sender As Object, ByVal e As
System.Componen tModel.CancelEv entArgs) Handles TextBox2.Valida ting

Dim tBox As TextBox = DirectCast(send er, 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***@dynamict ech.com.hk> wrote in message
news:e%******** ********@TK2MSF TNGP10.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
2619
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 follows: 1. At the beginning, focus is placed on an input text field of the first frame (so there's a blinking cursor on such field). 2. Then users click on a link of the second frame (thus focus is set
2
3092
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 Mozilla-only problem) I'm capturing the focus and blur events for the document, updating a
2
2010
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 be a little more precise. I have an app running (minimized) and without showing itself on the task bar. It puts an icon in the task pane (next to the clock), and when I click this icon, a message handler is invoked and creates a new usercontrol...
1
2230
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 page to Aspx2 which has a Datagrid. PageLoad of Aspx2 displays the DataGrid with existing data filled in and shows a new row (set of text boxes) in the Footer Item. Now, when I set the focus by accessing the first text box in the Footer
4
3944
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 textboxes and a checkbox. The behaviour I want from my app is as follows:- When the textbox (which is prior in tab order to the tab control) has been filled with a certain length of text by the user, the focus is
1
5133
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 the two steps, TextBox1.Text ="foo"; and TextBox2.Text = "bar";
11
7333
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 1.7.12 (linux kubuntu). It does work with konqueror. It seems to work with firefox on windows but not with IE (not completly sure though).
7
11917
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' and it steals the focus from the user's current application. How can I prevent the hidden WebBrowser from stealing focus? (And better yet can I even suppress that click?_
3
4243
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 application that need to "silently" use another app (called MapInfo) within itself - the intention is to use this app (which is quite sophisticated mapping application) and add some other extra functionality to it. We have a dll so we can run the...
2
2473
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. http://www.littleworksstudio.com/temp/usenet/focus.html To simulate the problem, just enter or change the "first" textbox and either click or tab to another control., it is tied to the onchange event. An alert box that simulates the "warning". When you close it the focus will not move...
0
8432
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8857
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8546
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7367
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2762
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 we have to send another system
2
1993
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1752
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.