VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Converting Decimal numbers to Binary

by K. Mehdi (1 Submission)
Category: Math/Dates
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Date Added: Wed 3rd February 2021
Rating: (5 Votes)

A function for converting decimal numbers to binary. Very fast.

Inputs
Decimal number (Long)
Code Returns
Binary number (string)
API Declarations

Rate Converting Decimal numbers to Binary

Private Sub Command1_Click()
DecValue = Val(Text1.Text)
BinValue = ""
Do
TempValue = DecValue Mod 2
  BinValue = CStr(TempValue) + BinValue
DecValue = DecValue \ 2
Loop Until DecValue = 0
'Print
'Print BinValue
Text2.Text = BinValue
End Sub

Download this snippet    Add to My Saved Code

Converting Decimal numbers to Binary Comments

No comments have been posted about Converting Decimal numbers to Binary. Why not be the first to post a comment about Converting Decimal numbers to Binary.

Post your comment

Subject:
Message:
0/1000 characters