|
-
October 7th, 2001, 01:38 PM
#1
Don't use symbols...
How can I stop certain symbols such as / \ : * ? < > | from being used in a text box?
Jonathon.
-
October 7th, 2001, 03:16 PM
#2
Re: Don't use symbols...
Edit them out something like this
private Sub Text1_KeyPress(KeyAscii as Integer)
Dim NoWant as string
NoWant = "/ \ : * ? < > "
If NoWant Like "*" & Chr$(KeyAscii) & "*" then KeyAscii = 0
End Sub
John G
-
October 8th, 2001, 04:47 AM
#3
Re: Don't use symbols...
You might want to remove the spaces from the string "NoWant"?
-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
Check out the new downloads - ImageMap.ocx is the VB control that emulates an HTML image map, EventVB.OCX for adding new events to your VB form and adding System Tray support simply, MCL Hotkey for implemenmting system-wide hotkeys in your application...all with source code included.
-
October 8th, 2001, 07:07 AM
#4
Re: Don't use symbols...
Got a point there
Tom Cannaerts
[email protected]
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
-
October 8th, 2001, 07:28 AM
#5
Re: Don't use symbols...
Did not notice that. It appears to be a flaw in Cut and Paste because I cut and pasted that string directly from the original post which does not have the spaces.
Will try it again to see what happens.
John G
-
October 8th, 2001, 07:31 AM
#6
Re: Don't use symbols...
I lied. The original post does have the spaces.
John G
-
October 8th, 2001, 07:37 AM
#7
Re: Don't use symbols...
Yeahyeah, blame it on someone else 
Tom Cannaerts
[email protected]
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
-
October 8th, 2001, 01:14 PM
#8
Re: Don't use symbols...
Thanks John,
Tried it, and it works perfecly,
Jonathon.
-
October 8th, 2001, 02:53 PM
#9
Re: Don't use symbols...
on keypress event
u can check its keyascii
suppose u want to cancel "a space" who's keyascii=32
if keyascii=32 then
keyascii=0
end if
or else if u dont know the keyascii then
if(keyascii=asc("/")) then
keyascii=0
end if
best of luck
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|