473,941 Members | 13,041 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TextBox 'Leave' Event not working

Hi,

I have an application that has (for the sake of argument) 2 (MDI) windows
open.
If I click into a textbox on FormA then the 'Enter' event for that TextBox
fires, great!
However, if I then click on FormB, then back to FormA although the cursor is
still flashing in the same textbox on FormA, when I tab out, the 'Leave'
event for that TextBox does not fire. If I stay on FormA and Shift-Tab back
into the textbox then the 'Enter' event fires again, then when tabbing out
again the 'Leave' event does fire this time...

Is this behaviour expected/normal, or am I doing somthing wrong. I will test
it with a couple of very simple forms if necessary, but thought I'd see if
people had any thoughts first :-)

Thanks,

Chris.
Jul 21 '05 #1
1 3312
OK,

I did what I said, to test, I've made a very simple Windows App. 1 MDI
Parent containing 2 Children.
FormA has 2 TextBoxes and a ListBox, and I've wired it up so that it bangs
an 'In' or 'Out' into the ListBox everytime one of the TextBoxes (TextBoxA)
Enter or Leave Event fires. The following table shows what goes into the
list box for each of the following actions...

Tab To TextBoxB Out
Tab back to TextBoxA In
Tab to TextBoxB Out
Tab Back To 1st TextBoxA In

<So Far So Good>

Click on FormB Out, Out
<Not Sure I understand that?>
Click back on FormA In
FormB Out
FormA In

<Making sense apart from the 1st one>
If you're not following this, we are now back on the FormA in TextBoxA

Tab to TextBoxB <NOTHING!!>
<Focus moves to other TB, but Leave event doesn't fire!>>
Back to TextBoxA In
Back to other TextBoxB Out
Back to 1st TextBoxA In
Can anyone give me a logical explaination for this behaviour, and give me
some ideas bout how I can get it to work as required (Leave event ALWAYS
fires when TextBox loses focus).

Thanks,

Chris.

"Chris Mayers" <ch************ **@SUEDEYahoo.C om> wrote in message
news:er******** ******@TK2MSFTN GP12.phx.gbl...
Hi,

I have an application that has (for the sake of argument) 2 (MDI) windows
open.
If I click into a textbox on FormA then the 'Enter' event for that TextBox
fires, great!
However, if I then click on FormB, then back to FormA although the cursor is still flashing in the same textbox on FormA, when I tab out, the 'Leave'
event for that TextBox does not fire. If I stay on FormA and Shift-Tab back into the textbox then the 'Enter' event fires again, then when tabbing out
again the 'Leave' event does fire this time...

Is this behaviour expected/normal, or am I doing somthing wrong. I will test it with a couple of very simple forms if necessary, but thought I'd see if
people had any thoughts first :-)

Thanks,

Chris.

Jul 21 '05 #2

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

Similar topics

2
6169
by: JayDee | last post by:
After a user enters data into a field, I need to populate other controls on the form, based on the user entry. I have to use either Leave, Validating or Validated, and I take it I can't use LostFocus because there is no selection for that event in the dropdown list on the code page. What's happening is that all 3 events mentioned above for the textbox control fire in the proper order when the form is invoked, but don't fire the first time...
1
2906
by: Zyrthofar | last post by:
Hi I have three textboxes indicating the individual RGB values of a color. When the user leaves a textbox (Leave event), I check the validity of that number and saves the three values to a set of raw data... The sub used handles the three textboxes's Leave events, and uses the 'sender' variable... Now I have a picturebox with GDI+ circles in it, representing the 8 different colors in the palette. You can choose the color number by...
2
2842
by: AussieRules | last post by:
Hi, I have a form with many textbox on it. Behind this(so to speak), is a class, and each time the user changes the value of the text box I want to update the relevant property of the class. I have the class.property = txtbox.text set on the textbox.leave event, and this works fine, except for when the user clicks on my toolbar button to save the details to the database.
6
2423
by: Frank | last post by:
Hopefully this is the correct group for this message. My previous post to (I assume) a non-.net group was not welcomed. I have a form with 7 text boxes that are all bound to fields of a dataset. The form also contains a datagrid also bound to the same dataset. I have a button on the form to update the data to the source.
1
307
by: Chris Mayers | last post by:
Hi, I have an application that has (for the sake of argument) 2 (MDI) windows open. If I click into a textbox on FormA then the 'Enter' event for that TextBox fires, great! However, if I then click on FormB, then back to FormA although the cursor is still flashing in the same textbox on FormA, when I tab out, the 'Leave' event for that TextBox does not fire. If I stay on FormA and Shift-Tab back into the textbox then the 'Enter' event...
1
2059
by: melanieab | last post by:
Hi again, I have a textbox where the text is longer than the textbox width. When I type something in there or even do any single keystroke (other than tab, up, down, or enter) and then leave, the beginning of the string shows, and focus goes on to the next box. But if I just tab through or want to go straight to the next textbox, the beginning of the string is cut off, leaving the end of the string visible. More info that may/may not be...
5
7467
by: =?Utf-8?B?QmVuIFIu?= | last post by:
Hi, In a .NET 2.0 winforms application, I've got a textbox that, when updated, uses the validated event to cascade the change to another textbox (along with another value). This works well if the user does indeed move the cursor to another textbox, but if the user clicks my "done" toolstripbutton after making a change in the textbox but without moving the cursor out, the validated event never fires. I have a pretty bad workaround where...
4
2325
by: dbuchanan | last post by:
On the help page "TextBox Members" clearly there is an event for LostFocus. It is inherited from control. So without the event directly available for TextBox how do I use it? I know I could create the event in code, but isn't there a more direct way?
2
3737
by: jd | last post by:
I have several textboxes in which the end user can enter values. When the user presses the Enter key when in any of the textboxes, or leaves that textbox, I want a routine to run (mathematical analysis followed by plotting a graph). Since it is relatively slow (less than a second, but makes the updating sluggish) I only want it to be triggered when the value in one of the textboxes is actually changed by the user - pressing Enter or leaving...
0
10135
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
9968
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
11297
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
7390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6087
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4909
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
4509
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3509
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.