Question VB 2010: textbox question

bibang

Member
Joined
Dec 27, 2012
Messages
9
Programming Experience
Beginner
im not sure if i posted at the right section,im sorry but my question is about textbox control, question no.1: heres the scenario for example i want to clear the first 5 chars when i entered the 6th char, for example 1 entered "12345" and then when i entered the 6th char,for example "6" it will delete the first 5 chars resulting to only "6" remains, same as when u continue "678901" , "67890" will be cleared, and remains "1", is it possible? thanks a lot

for my question no.2: is it also possible to clear the characters on the textbox just after i typed it with a time interval, for example 5 seconds after i typed such "N" number of chars. for example i typed "12345" and then after 5 seconds it will be cleared, thanks a lot, thank you for your help
 
1. Handle the KeyPress event of the TextBox. To learn a bit about keyboard events, follow the Blog link in my signature and check out my post on the subject. Check whether the character being entered is not a control character. The Char.IsControl method will be helpful there. If it's not then check whether the length of the current text is 5 characters. If it is then clear the TextBox. In case you were thinking of asking, no I won't provide an example but I'm happy to help you fix your code if it doesn't work when you try it for yourself.

2. You need to clarify that somewhat. Do you want each character to disappear 5 seconds after it was entered or do you just want the lot deleted 5 seconds after the last character was entered? If the latter, exactly what indicates that the user has finished typing? Remember, you can't give a computer vague instructions and expect it to figure out what you mean. You have to define the problem precisely.
 
Back
Top