Hello! Help me solve the following problem: I have two textboxes. The number of digits in one textbox is two. When I enter the second digit in the first textbox I want that the second textbox gets focused. is that possible? :sign0085: kavkaa
Sure, it's possible. The most logical thing to do would be to catch this with the KeyPress event. There's a problem, though - the KeyPress event gets raised *before* the key you pressed actually gets added to the textbox. At least that's the behavior on my desktop and device. So I've been using a little workaround that involves a timer. Create your form, textbox1, textbox2, and timer1. In AppStart: Code: timer1.interval = 100 ' thats 100 millisecondstimer1.enabled = false and then: Code: sub textbox1_KeyPress( key ) timer1.enabled = trueend subsub timer1_Tick if StrLength( textbox1.text) >= 2 then textbox2.Focus timer1.enabled = falseend sub It comes close to a cheezy hack, but hey, it works for me. Gary :sign0025:
You could use my ControlEvents library that adds "missing" events to B4PPC controls and catch the TextChanged event of the TextBox which occurs after the key press is added. Much better than cheesy hacks (Apologies willisgt!) http://www.basic4ppc.com/forum/showthread.php?t=934
agraham, can you help me out with this missing events. Do I just copy those three files in the library directory and that is that?
Sounds like you need to learn how to use libraries. You should have downloaded the latest ControlEvents version from either Post #5 (.Net 2.0) or #6 (.NET1.0) from that thread. One of those files is a help file, the chm, the library is the dll - stick the help and the library in the Anywhere Software Libraries folder. Ignore and discard the cs file - you don't need it. Restart B4PPC - Desktop. The ControlEvents help should now show under Help - read it and the Main help about libraries.