Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Closed Thread
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 1st, 2007, 07:28 PM
Kyuss25 Kyuss25 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2007
Posts: 4 Kyuss25 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 13 m 38 sec
Reputation Power: 0
Convert Binary to Decimal in VB

I've been looking for a way to do this for about two weeks now. Searching Google, Yahoo and even these forums. My question is. How can you convert Binary to Decimal? The app I am writing needs to take a binary number that someone enters into a text box, convert it to decimal and output that to another text box. This would be done with a button click event of course. I've got everything together except that part. I'm using Visual Studio 2005. Any help would be appreciated.

Reply With Quote
  #2  
Old December 1st, 2007, 09:38 PM
medialint's Avatar
medialint medialint is offline
Type Cast Exception
Dev Shed God 20th Plane (14500 - 14999 posts)
 
Join Date: Apr 2004
Location: OAKLAND CA | Adam's Point (Fairyland)
Posts: 14,938 medialint User rank is General 112nd Grade (Above 100000 Reputation Level)medialint User rank is General 112nd Grade (Above 100000 Reputation Level)medialint User rank is General 112nd Grade (Above 100000 Reputation Level)medialint User rank is General 112nd Grade (Above 100000 Reputation Level)medialint User rank is General 112nd Grade (Above 100000 Reputation Level)medialint User rank is General 112nd Grade (Above 100000 Reputation Level)medialint User rank is General 112nd Grade (Above 100000 Reputation Level)medialint User rank is General 112nd Grade (Above 100000 Reputation Level)medialint User rank is General 112nd Grade (Above 100000 Reputation Level)medialint User rank is General 112nd Grade (Above 100000 Reputation Level)medialint User rank is General 112nd Grade (Above 100000 Reputation Level)medialint User rank is General 112nd Grade (Above 100000 Reputation Level)medialint User rank is General 112nd Grade (Above 100000 Reputation Level)medialint User rank is General 112nd Grade (Above 100000 Reputation Level)medialint User rank is General 112nd Grade (Above 100000 Reputation Level)medialint User rank is General 112nd Grade (Above 100000 Reputation Level)  Folding Points: 319635 Folding Title: Super Ultimate Folder - Level 1Folding Points: 319635 Folding Title: Super Ultimate Folder - Level 1Folding Points: 319635 Folding Title: Super Ultimate Folder - Level 1Folding Points: 319635 Folding Title: Super Ultimate Folder - Level 1Folding Points: 319635 Folding Title: Super Ultimate Folder - Level 1Folding Points: 319635 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 6 Months 2 Weeks 2 Days 26 m 38 sec
Reputation Power: 8490
Facebook
__________________
medialint.com

“Today you are You, that is truer than true. There is no one alive who is Youer than You.” - Dr. Seuss

Reply With Quote
  #3  
Old December 1st, 2007, 11:23 PM
Kyuss25 Kyuss25 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2007
Posts: 4 Kyuss25 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 13 m 38 sec
Reputation Power: 0
Thanks for the help. I got it worked out. If you're interested this is the variation I got to work.

Code:
Public Function BinaryToDecimal(ByRef Binary As String) As Integer
        Dim BinaryNum As Integer
        Dim BitCount As Short

        For BitCount = 1 To Len(Binary)
            BinaryNum = BinaryNum + (CDbl(Mid(Binary, Len(Binary) - BitCount + 1, 1)) * (2 ^ (BitCount - 1)))
        Next BitCount
        BinaryToDecimal = BinaryNum

    End Function

    Private Sub btnConvert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConvert.Click
        txtDecimalNum.Text = (BinaryToDecimal((txtBinaryNum.Text)))

    End Sub

Reply With Quote
  #4  
Old June 4th, 2010, 02:09 AM
ehbob23 ehbob23 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2010
Posts: 1 ehbob23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 sec
Reputation Power: 0
thanks for this post

This is the same code I needed in my Loan Thesis. Thanks for the one who posted this code..I've been having big troubles in finding ways to solve the same problem with for next loop, i think this could help.

thanks.

Reply With Quote
  #5  
Old June 7th, 2010, 01:12 AM
GiffordBruno GiffordBruno is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2010
Posts: 12 GiffordBruno User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 22 m 58 sec
Reputation Power: 0
GiffordBruno

That's the same code that i want,thanks for sending this code.

Reply With Quote
  #6  
Old July 3rd, 2012, 11:25 PM
mechanic_2 mechanic_2 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2012
Posts: 1 mechanic_2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 58 sec
Reputation Power: 0
Hello all,
I'm new to this site but I'm not new to the world. Here is something for all of you students to think about. If you are working on some type of school assignment and you use the code that someone else has written for you. You are facing failing the course and being expelled from school. You can also be facing federal criminal charges and be required to return any and all student aid. The federal government is very strict about this and they do prosecute. I just though that you should all know about the consequences for plagiarism. You can use the code to get some ideas about how to proceed but if you use the code out right you are in serious trouble. There are a lot of professors that go on these sites looking for this kind of cheating and it is cheating. When I was in school I know of a girl from China who did this. She wasn't prosecuted but she was deported. The last that I heard the Chinese government put her and her whole family in a Chinese prison. Is it really worth it. Design your own code and ask for help with it but don't ask others to write the code for you. Just a friendly warning.
Thanks,
rich!

Quote:
Originally Posted by ehbob23
This is the same code I needed in my Loan Thesis. Thanks for the one who posted this code..I've been having big troubles in finding ways to solve the same problem with for next loop, i think this could help.

thanks.
Comments on this post
medialint disagrees: But in the real world I borrow code all the time to solve a part of a bigger problem. I do tend to
agree but if the thesis (two years ago) was five lines of code ... well ...

Reply With Quote
Closed Thread

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Convert Binary to Decimal in VB

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap