[vb quest] convert a decimal to binary

Discussion in 'QnA (read only)' started by mach, Jan 31, 2006.

Thread Status:
Not open for further replies.
  1. mach

    mach New Member

    Joined:
    Sep 16, 2005
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Amidst the stars
    hi there,
    can ny1 tell me how to convert a decimal no into binary in visual basic 6.0

    sending the function a call (argument is the decimal)
    getting back the binary as string

    say i send a no 45
    i need to return the string :101101

    can ny1 help me d this
    thnx
     
  2. legolas

    legolas New Member

    Joined:
    Feb 8, 2005
    Messages:
    959
    Likes Received:
    0
    Trophy Points:
    0
    usually, the method of converting decimal to binary is to convert to hexa and then write it in 4's i think. (45)10 = (2D)16. then u can write 2D as, (0010)(1101).

    if u need the alg. this is it. in any programming language, the alg. is wat imp. u can code using the syntax and commands.

    /legolas
     
  3. alib_i

    alib_i New Member

    Joined:
    Jun 24, 2004
    Messages:
    1,191
    Likes Received:
    2
    Trophy Points:
    0
    Location:
    omnipresent
  4. thetopcyborg

    thetopcyborg New Member

    Joined:
    Sep 17, 2005
    Messages:
    231
    Likes Received:
    0
    Trophy Points:
    0
    you can even use the windows inbuilt calculator.....

    from view, select scientific.....press F6(to ensure that u r entering the numerals in decimals)....then press F8...the number which is displayed is the binary form of the nunmber which you entered earlier.....u can use this in vb6 then :lol:

    eg, i pressed F6....entered 4784and then i pressed F8....the number which was displayed was 1001010110000 which is the binary form of 4784


    p.s if you don't wanna press F8 and F6, there are radio buttons on the left(top) corner of the scientific calc....use that
     
Thread Status:
Not open for further replies.

Share This Page