Welcome to Dream.In.Code
Become a VB Expert!

Join 149,966 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,359 people online right now. Registration is fast and FREE... Join Now!




VB Changing Bases

 
Reply to this topicStart new topic

VB Changing Bases

Incronical
5 Jan, 2008 - 04:52 PM
Post #1

New D.I.C Head
*

Joined: 11 Mar, 2007
Posts: 2



Thanked: 1 times
My Contributions
I need to write a program that will do this:

Given a value and a Base, Show a Asc(decimal), Hex, And binary bit pattern.

Since i'm kinda challenged on tackling the problem i tried and made a program that ( or so i believe) displays the bit pattern of the base. If i am correct, where do i go from there?

CODE

Private Sub Command1_Click()
myval = Asc(Text1.Text)
Bit = Val(Text2.Text ^ 7)
bitpattern = ""
Do
  If myval < Bit Then
    bitpattern = bitpattern & "0"
     Bit = Bit / 2
   Else
    bitpattern = bitpattern & "1"

    myval = myval - Bit

    Bit = Bit / 2
   End If

Loop Until Bit < 1
MsgBox bitpattern
End Sub

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 06:20PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month