Hi All,
I was trying to find the easiest way to either not allow a $ sign to be entered in an input box, or to check for and strip this character out of the resulting variable.
Thanks
Grizz2
If you wanted them to stop entering the $ into the input box then use
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = Asc("$" Then KeyAscii = 0
End Sub
This is in the Keypress event of your text box. when they press the $ nothing appears in the textbox. You might also want to put a Beep or a message to tell them it is an illegal key press.
Any Help, Yes/No let me know
Regards
________________________________________
Is not a fool a wise man in his own eyes - Proverbs
Laffalot's solution applies to a TextBox, not to an InputBox
If you want to use the latter (your choice) then the following statement strips it of any $ sign.
strInput = Replace(InputBox("Enter a New Text", "$", ""
Be aware that in this case the user has no visible clue that you stripped the $ signs ....
_________________________________
In theory, there is no difference between theory and practice. In practice, there is. [attributed to Yogi Berra]
Thanks for all the help.
The keypress code was my first thought but couldn't figure how to associate it with the input box.
The split() from above worked fine but I ended up using the Replace() from rvBasics post since this used the least amount of code.
Thanks Again
Grizz2
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.