VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



AMAZING DECIMAL TOBINARY IN A FEW LINES OF CODE

by QUASI-MODE (1 Submission)
Category: Miscellaneous
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (2 Votes)

make a DEC2BIN code easy and quick to run.

Rate AMAZING DECIMAL TOBINARY IN A FEW LINES OF CODE

Asume that you have a dialog form with a commandbutton, a textbox and a label on it.
Private Sub Command1_Click()
Dim I
Label1.Caption = ""
For I = 7 To 0 Step -1
  Label1.Caption = Label1.Caption + Str((Text1.Text And 2 ^ I) / 2 ^ I)
Next I
End Sub
put a number in the textbox, click on the command and the label will show the binary secuence.
it's works. I promise!
it use bit mask to get to the bits on the bytes.

Download this snippet    Add to My Saved Code

AMAZING DECIMAL TOBINARY IN A FEW LINES OF CODE Comments

No comments have been posted about AMAZING DECIMAL TOBINARY IN A FEW LINES OF CODE. Why not be the first to post a comment about AMAZING DECIMAL TOBINARY IN A FEW LINES OF CODE.

Post your comment

Subject:
Message:
0/1000 characters