I'm having a strange little problem I can't figure out.
I have a Windows form with several controls on it. One control is a textbox where the user can enter a 10-digit code. This box may also be filled in programmatically in certain situations.
The problem is, if I fill the box in from code, then try to set the focus to the next control, the focus doesn't change. Here's basically what I'm trying to do:
Seems simple enough. But the focus remains on the textbox.
There's an event handler for textbox.lostfocus which does some validation on the input. I've commented this code out, though, and still get the same results.
I've tried changing the focus to several different controls, just to see if I can get it to move. I've tried using SendKeys.send to simulate a tab key. No matter what I do, the focus won't leave the textbox.
If the user enters the code and hits tab, the focus changes just fine.
Anyone have any idea what could be wrong, or what more I could try? This is really driving me mad.
Any help would be greatly appreciated.
JRL
I have a Windows form with several controls on it. One control is a textbox where the user can enter a 10-digit code. This box may also be filled in programmatically in certain situations.
The problem is, if I fill the box in from code, then try to set the focus to the next control, the focus doesn't change. Here's basically what I'm trying to do:
Code:
textbox.text="1234567890"
cbType.focus()
Seems simple enough. But the focus remains on the textbox.
There's an event handler for textbox.lostfocus which does some validation on the input. I've commented this code out, though, and still get the same results.
I've tried changing the focus to several different controls, just to see if I can get it to move. I've tried using SendKeys.send to simulate a tab key. No matter what I do, the focus won't leave the textbox.
If the user enters the code and hits tab, the focus changes just fine.
Anyone have any idea what could be wrong, or what more I could try? This is really driving me mad.
Any help would be greatly appreciated.
JRL