THANKS YOU ALL for your replies...
every anwser was very interesting but the simplest and best solution was 
Dominique's (special thanks).
here is the final code :

' Gambas class file
' Designed by Vlahonick
PUBLIC SUB _new()

END

PUBLIC SUB Form_Open()

END

PUBLIC SUB Button1_Click()

DIM S AS String
DIM i, y, N, d AS Integer
 
    S = Textbox1.Text
    y = Len(S)
    IF y = 0 THEN RETURN
    N = 0
    FOR i = 1 TO y
       d = Val(Mid(S, i, 1)) 
       N += d * (2 ^ (y - i))
    NEXT
    Textbox2.Text = N 
END

PUBLIC SUB Button2_Click()

ty all again , Vlahonick

  textbox1.text = ""
  TextBox2.text = ""

END



_________________________________________________________________
Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.

http://www.microsoft.com/windows/windowslive/products/photos.aspx
------------------------------------------------------------------------------
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