Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Function for Converting Binary to Decimal
Message
General information
Forum:
Visual Basic
Category:
Other
Miscellaneous
Thread ID:
00238462
Message ID:
00238476
Views:
14
>I'm looking for a function in VB that can convert binary into decimal. I`ve searched the online help. Any ideas.

The formula works like this

0 = 0
1 = 1
10 = 2
11 = 3
100 = 4
...

So the forumula is for each nth digit in the binary number multiply the binary digit by 2 to the power of N-1

100 = 1x2x2 + 0x2 + 0x1 = 4
111 = 1x2x2 + 1x2 + 1x1 = 7
Previous
Reply
Map
View

Click here to load this message in the networking platform