Public Functions and Ascii Code

k209310

Registered User.
Local time
Today, 21:15
Joined
Aug 14, 2002
Messages
184
Hi

I created some ASCII code that only allows a backslash (\) and numeric chartacters to be entered in to a text box. This works fin in the keypress event.

However if i create the code in a module as a public function and try to call it from the key press function then the code fails (all spellings are correct) althought the function works when tested with other code.

Does any bofy have any idea why i cant create a function to delete ascii characters.

This isnt a huge a problem but it will be easier to create a function than to put the code in to every keypreess event where it is needed. The ascii code is below

Select Case KeyAscii
Case Is < 46
KeyAscii = 0

Case Is > 57
KeyAscii = 0

End Select


Thnaks in advnace

Chris
 
You are going to have pass the value of KeyAscii to your function, and return (via the function name) the value you want, and assign that to KeyAscii in the KeyPress event.

KEYPRESSEVENT(KeyAscii)
KeyAscii = myCheckFunc(KeyAscii)
EndSub

Function myCheckFunc(ChkKey as integer) as integer
myCheckFunc = ChkKey
Select case ChkKey
Case Is < 46
myCheckFunc = 0
Case Is > 57
myCheckFunc = 0
End Select
End Function
 

Users who are viewing this thread

Back
Top Bottom