[Gambas-user] Hello all :D Can anybody tell me how i can make a...

vlahonick vlahonick tsopanotragi at ...67...
Thu May 7 15:42:24 CEST 2009


Hello all :D
Can anybody tell me how i can make a value to calculate something only if the user put specific numbers?
EXAMPLE: 
        Dim S As String
        Dim i, y, N, d As Integer
        S = TextBox1.Text
        y = Len(S)
        N = 0
        For i = 1 To y
            d = Val(Mid(S, i, 1))
            N += d * (2 ^ (y - i))
        Next
        TextBox2.Text = N

now i want the whole string to be calculated only if "d" gets the values of "0" or "1" and if the user puts anything else to have a msgbox that says error.

So the theme is that i want to allow the user to put in the textbox1 only  0 or 1.
The problem is that if i use textbox1.text <> "0" then etc. , the user
is allowed to put only one time the "0" so in this case that he puts 00 will
give him the same error for puting for example the latter "a".
So i want to allow the user to put in the TextBox1 only 0 or 1 but as many times as he wants :D

FOR ANY IDEAS OR ANWSERS please contact me direct to my e-mail

tsopanotragi at ...67...


THANKS IN ADVANCE (vlahonick->www.vlahonick.freehost.gr)

_________________________________________________________________
More than messages–check out the rest of the Windows Live™.
http://www.microsoft.com/windows/windowslive/



More information about the User mailing list