Private Sub Text1_KeyPress(KeyAscii As Integer)
'// Capitalize the entered small letters.
If KeyAscii > 96 And KeyAscii < 123 Then KeyAscii = KeyAscii - 32
End Sub
Consider using the UCase command but i would watch out for how you are using the data. For example if the user pastes the data into the text box using the mouse your keypress event will not fire. Before you use the data it may be best to implement it there. i.e.
If you step through this, you will notice that the Change event fires a second time and all the code is executed again.
You cannot prevent the event from firing again, but can keep the code from executing again using the mentioned flag:
Private Sub Text1_Change()
Static bGetOut As Boolean
If bGetOut Then Exit Sub
bGetOut = True
.
.
.
.
bGetOut = False
End Sub
CClint> Sorry buddy, didn't read the post properly, and also didn't realise that the code executes twice, although if it thought about it logically.... lol
A Star for you for the Getout Clause, I just wish i had a "Static bGetOut as Boolean" when i got married!
[tt]"Do not put off until tomorrow what you cannot put off until the day after tomorrow just as well." - Mark Twain[/tt]
i did not read the remarks of "ca8msm".. thanks for the info.. ill use it in change event and apply static boolean from now on for that prob also..
long way to go..:-(
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.