Hi everyone
This MUST have been covered many times, but I haven't been able to
find it through the archives.
I'm looking for simple editfield validation, i.e reject
non-alphanumeric characters (and allow spaces !) as they are typed in
an editfield.
I have placed the following code in the 'TextChange' event of the editfield :
dim txt as string
txt="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 "
if instr(1,txt,mid(me.text,me.selstart,1))<1 then
me.text=replace(me.text,mid(me.text,me.selstart,1),"")
me.selstart=me.selstart-1
end if
Now... this IS working, but it is visibly slow (can see the 'replace'
happen on my iMac 400 DVSE,[compiled!])...
There must be a neater way of doing this ! Any ideas ?
Thanks
Brian
--
|