TextBox 'Leave' Event not working

C

Chris Mayers

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.
 
C

Chris Mayers

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.
 

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

Top