# How do I convert the Decimal number in Binary number in VB.NET

Page 1 of 1

## 1 Replies - 12754 Views - Last Post: 22 March 2007 - 10:08 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=25280&amp;s=551aabf52525f004ca23359b17e1496f&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 apoli87

Reputation: 1
• Posts: 7
• Joined: 20-September 06

# How do I convert the Decimal number in Binary number in VB.NET

Posted 19 March 2007 - 11:18 PM

I want to create a simple calculator using Visual Basic.Net 2003. The Scope of my Project is to perform a simple number system like to convert a dicimal value to binary, octal, hexadecimal and vice versa. My Problem is the code of decimal to binary, Decimal to hexadecimal. I hope you can help me!!
Is This A Good Question/Topic? 0

## Replies To: How do I convert the Decimal number in Binary number in VB.NET

### #2 spullen

• D.I.C Regular

Reputation: 10
• Posts: 356
• Joined: 22-March 07

## Re: How do I convert the Decimal number in Binary number in VB.NET

Posted 22 March 2007 - 10:08 PM

For decimal to binary conversion, think about how it works. So first you want to find the highest value base 2 that can go into the number you are trying to convert, without going over the that number, so that will be a 1, then subtract that from the original number. Then start moving down (decrementing) the exponent if it goes into it then it's a 1 and then subtract that from the value and find the next one, and if it doesn't go into it then it is represented as a 0.
So try it out and just come up with an algorithm for it, it shouldn't be too hard, and it will be similar for finding it in octal, and hexidecimal.