Am Donnerstag, den 09.04.2009, 12:23 +0100 schrieb Joshua Higgins:
> Hi,
> 
> Is it possible to disallow certain characters from being entered in a
> TextBox?
> 
> I'm splitting the data from the textbox and don't want the user to type in
> the character (~) that is being used to split.
> 
> Thanks.

Salut,

here the KeyPress Event from TextBox1 looks for valid Keys (this is out
of a gambas1 project)

PUBLIC SUB TextBox1_KeyPress()
    IF key.Code >= 48 AND key.Code <= 57 THEN
    ELSE IF key.Code = key.BackSpace THEN
    ELSE IF key.Code = key.Delete THEN
    ELSE
        STOP EVENT
    ENDIF
END

So, you have to write something like :
(this is not tested) 
IF key.Code = "~" THEN
        STOP EVENT
ENDIF

-- 
Amicalment
Charlie


------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to