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 tsopanotr...@hotmail.com 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/ ------------------------------------------------------------------------------ The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user