Results 1 to 3 of 3

Thread: decimal to binary?[resolved]

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,547

    Resolved decimal to binary?[resolved]

    does anyone have a function to convert decimal to binary?
    Last edited by high6; Feb 5th, 2006 at 08:10 PM.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: decimal to binary?

    The .NET Framework does:
    VB Code:
    1. Dim myBinaryString As String = Convert.ToString(myNumber, 2)
    You can also specify 8 or 16 to convert to octal or hexadecimal. To convert a binary string to a number you would use:
    VB Code:
    1. Dim myNumber As Integer = Convert.ToInt32(myBinaryString, 2)
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,547

    Re: decimal to binary?

    Quote Originally Posted by jmcilhinney
    The .NET Framework does:
    VB Code:
    1. Dim myBinaryString As String = Convert.ToString(myNumber, 2)
    You can also specify 8 or 16 to convert to octal or hexadecimal. To convert a binary string to a number you would use:
    VB Code:
    1. Dim myNumber As Integer = Convert.ToInt32(myBinaryString, 2)
    thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width