>>>>>>>The easiest way to get the codes is to stick a WAIT WINDOW STR(nKeyCode) in the KeyPress.
>>>>Look in the Online Help under Inkey(). It lists the KeyCodes.
>>>
>>>Actually, it misses a bunch of them, such as the apostrophe and quotations mark. That's why I recommended trying it to find out....
>>
>>
>>Garrett,
>>
>>I couldn't find the key codes for (') and ("), so I used the following code in the valid method of the textbox:
>>
>>Local temptext
>>
>>temptext = occurs("'",this.value)
>>
>>if temptext>0
>> =messagebox("This field cannot contain the (') character!",16,osys.Appname)
>> this.value = ""
>> thisform.refresh()
>>ENDIF
>>
>>
>>That takes care of the ('), but not the ("). Oh well, I'll stick with this for now unless someone knows where to find these key codes.
>>
>>AL
>
>Sorry for interrruption,
>nKeycode1=asc('"')
>nKeycode2=asc("'")
Edward,
Thanks for your input. I now have the code in the keypress method as follows:
LPARAMETERS nKeyCode, nShiftAltCtrl
LOCAL nkeycode1, nkeycode2
nKeycode1=asc('"')
nKeycode2=asc("'")
if nKeycode=nkeycode1
wait window "Cannot use the quotation mark character in this field !" nowait
nodefault
endif
if nKeycode=nkeycode2
wait window "Cannot use the apostrophe character in this field !" nowait
nodefault
endif
I much prefer this approach compared to having the code in the valid method.
Thanks again, AL
Al Williams
Anola MB, CANADA