VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



CONVERTING A DECIMAL NUMBER INTO BINARY

by C .R.RAJAGOPAL STAR TECHNOLOGIES (2 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 28th June 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)

CONVERTING A DECIMAL NUMBER INTO BINARY

API Declarations


Dim T(500) As String
Dim W(500) As String
Dim Y(500) As Integer
Dim NUM As String

Rate CONVERTING A DECIMAL NUMBER INTO BINARY



NUM = Text1.Text
L = Len(NUM)
For I = 1 To L
T(I) = Left(NUM, I)
Next I
For I = 1 To L
W(I) = Right(T(I), 1)
Next I
For I = 1 To L
Y(I) = Val(W(I))
Next I
Let S = 0
For I = L To 1 Step -1
S = S + Y(I) * (2 ^ (L - I))
Next I
Text2.Text = S
End Sub

Private Sub Cmdclear_Click()
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
End Sub

Private Sub Cmdquit_Click()
Unload Me
End
End Sub

Private Sub Form_Activate()
Text1.SetFocus
End Sub

Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
End Sub


Download this snippet    Add to My Saved Code

CONVERTING A DECIMAL NUMBER INTO BINARY Comments

No comments have been posted about CONVERTING A DECIMAL NUMBER INTO BINARY. Why not be the first to post a comment about CONVERTING A DECIMAL NUMBER INTO BINARY.

Post your comment

Subject:
Message:
0/1000 characters