1 Replies - 12491 Views - Last Post: 22 March 2007 - 10:08 PM Rate Topic: -----

#1 apoli87  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • 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  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 10
  • View blog
  • 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.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1