|
-
Mar 9th, 2000, 07:43 PM
#1
Thread Starter
New Member
Having big probs writing a vb program that converts a binary number to Decimal and Hexidecimal. if you can help let me know.
Also could you tell me how to set the properties.
Thanks.
Sarah Jamerson
-
Mar 9th, 2000, 08:21 PM
#2
Hyperactive Member
Hello AnimalCub,
Try this source
Private Sub Form_Load()
Dim Q As String
Dim N As Integer
Dim Antwoord As Double
Q = "1010" 'the binary value
Antwoord = 0
For N = 0 To Len(Q) - 1
Antwoord = Antwoord + Val(Mid(Q, Len(Q) - N, 1)) * (2 ^ N)
Next
MsgBox Antwoord 'answer decimal
MsgBox Hex(Antwoord)'answer hexadecimal
End Sub
Be nice to the animals!
Michelle.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|