Professional Documents
Culture Documents
Binary/Hex/BCD/Octal/Decimal Converter
ey
m an electrical engineer and im just starting to learn vb.. Since i have to do a lott
umber conversions when working with processors/PLCs i thought i might try to
write a program that allows me to convert between all the different number
ystems.. only thing is, i dont really know where to start.. Anyone have any tips? I
now how to convert all the number systems longhand so i know the math behind
, but the programming is just beyond me
hanks
ichie
ee Related Forum Messages: Follow the Links Below to View Complete Thread
was wondering if anyone can help me understand the conversions between all Binary, Decimal, Hexadecimal, Octal Notation
umbers/letters.
st explain them all to me, and how to convert each of them. I got a sheet, but it doesn't explain how to convert them.
ode:
ivate Sub cmdD2B_Click()
cture1.Cls
umber = Val(txtDecimal.Text)
o While Number >= 2
um = Number Mod 2
umber = Int(Number / 2)
cture1.Print Num
oop
Number = 1 Then
cture1.Print 1
seIf Number = 0 Then
cture1.Print 0
nd If
nd Sub
get a Picture box that displays the binary Number vertically...I want to print it horizontally...got any idea's. I would really like to
int it in the text box but that is not necessary!
hanks in advance!
nary To Decimal Converter?
i there I am a beginner to Visual Basic. I am currently running Visual Basic 6.0. So far the only programs I have created are a loa
alyzer and a cash register program. I want to create a program that can convert IP addresses into Binary code and vice versa. suc
255.255.255.255 = 11111111.11111111.11111111.11111111
an anyone please help. This is driving me crazy!!
ith how many digits can i represent the largest number that can be recieved with multiplying two single digits in the octal system
ase 8). And which number will that be.
ow i wanna know how the f*** do i convert 0x11 in hex to decimal (would be 17) ???
nary To Octal---help!!
m having trouble with regards my very simple program which is converting binary to octal in visual basic. our teacher required u
put only 4 characters. i'm very confused when it comes to LEN. Please help me. Here's what i've started and the output is always
7.
igvalue=val(txtvalue.text)
Right$(Len(origvalue), 1) Then
=1
ext4.Text = a
se
=0
nd If
Right$(Len(origvalue), 2) Then
=4
ext4.Text = a + b
se
=0
nd If
Right$(Len(origvalue), 3) Then
=4
ext4.Text = a + b + c
se
=0
nd If
Right$(Len(origvalue), 4) Then
=8
ext4.Text = a + b + c + d
se
=0
nd If
d found:
---Messaggio originale-----
nary Converter
have created a program that converts from text to binary, but I dont know how to decode it... can anyone help? If you need my
de.. here it is so far.
B Code:
im loopcounter As Integer Public Function cBIN(ByVal ic As Integer) As StringDim x As Long, bC As BytecBIN = ""x = 256Fo
1 to 8 bC = 0 x = x / 2 If iC >= x Then bC = 1 iC = iC - x End If cBIN = cBIN & bCNext YEnd
unction Private Sub cmdConvert_Click()Text2.Text = "" For loopcounter = 1 to Len(Text1.Text) singlechar = Mid(Text1.Text,
opcounter, 1) int char = Asc(singlechar) Text2.Text = Text2.Text & cBin(intchar) & " " NextEnd Sub
hanks in advance
nary/integer Converter
ed a bit of a big help here. i got my NIM game halfway there under my own steam. BUT........ Now i am at the stage that i need a
ort program to convert integer to binary, then perform an XOR, and finally do a binary to integer conversion.
ny help? Push in the right direction, or if you have got one already?
m making a string to binary converter for us lazy ass students and its going cool...BUT....it'd be nice if it converted it back the oth
ay as well (Binary to Decimal and Binary to String)
heers
d
binary to binary conversion= for example we can add one binary value (1110) + another binary value(0101) = i want this
utput(100 1 1)but it comes 1211 this is my question how can i rectify ?
convert from hexadecimal to decimal conversions (ex)in decimal 12 to hexa is c . it wirks good ,but my question is how to conv
xadecimal to deimal (12) ?
ks in Advance
--------------------------------------------------------------------
ARD WORK NEVER END FAILS"
ecimal To Binary
m trying to find a way to convert decimal to binary in vb, i searched around and found:
B Code:
im Number As IntegerDim Binary_String As String Number = Val(Text1.Text)Binary_String = ""While Number > 0
nary_String = Str(Number Mod 2) & Binary_String Number = Number 2WendText2.Text = Binary_String
is works fine except for it leaves spaces in between each character when i run it, what is wrong with this code?
ecimal To Binary
m programming a subnet mask calculator and i need to change a decimal value entered by the user to binary value which will be
splayed in a label...any ideas?
isco Duck
ecimal To Binary
st ewondering if there is a simple way of converting a decimal number to its binary equivalent
nary To Decimal
need to change a string which is a 12 bit binary value into its decimal equivilant.
ny easy way?
heers in advance
ndy Dunn
ecimal To BInary
elp
need to change a deciml number, say 28 into its equivialnt binary pattern 011100?
ny easy way?
heers in Advance
ndy
nary To Decimal
need to convert a binary number, read from a text file, to it's decimal equivalent. It's in two's complement format, i.e can be
gative.
oes anybody have a suitable routine or can anyone point me in the right direction?
any thanks
he project is to create a program to convert an 8 digit binary number into a decimal number. Remember I'm a newbie so please do
ost functions.
I probably won't be able to understand them, and 2. I need to submit the source code with the program.
understand prefectly how decimal numbers are calculated from binary. And all I really need to find out is the code for analysing
ch individual digit so I can tell VB to than if the first place is 1 make a variable with the vale 2^0 and if the second place is 1 ma
other with the value 2^1 etc... That really is the key to my sucess at the moment.
EEEEEEEEEEEELLLLLLLLLLLLLLPPPPPPPPPPPPPPPP!
ex/decimal To Binary
need to know if there is any way to convert hex or decimal to its equicvalent binay format
need only 4 bit binary....
hanx in advance
rs
nary/Hex/Decimal Arithmetic
need to do the following:
ode:
2 80 00 3 hex values
0000010 10000000 00000000 binary form of each
000010 0000000 0000000 drop bit 7
00001000000000000000 concatenate
000|0000|1000|0000|0000|0000 create 4-bit groups starting from right
0 8 0 0 0 hex value of each group
2768 decimal value of above
nything I have attempted so far does not produce the correct result.
nary/Hex/Decimal Conversions
there a function, API call, or something that can convert a binary/hex/decimal to binary/hex/decimal? I know Hex() does hex, bu
there a way to do binary decimal and so on? Thanks.
ould anyone tell me how to convert an integer less than 25 into a 4 bit binary number
ode:
im i, Power, Number, DecNum As Integer
im Digit As Single
nary/Decimal Conversion
k: i was looking at this thread: http://www.xtremevbtalk.com/show...ary+conversion
d i thought it would be really cool to make a program that converts binary to decimal, and vice versa..
ode:
im Binstr As String
exstr = Hex$(number)
or LV = 1 To Len(HexStr)
elect Case Mid$(Hexstr, LV, 1)
ase "0"
nStr = BinStr & "0000"
ase "1"
nStr = BinStr & "0001"
ase "2"
nd so on.
ase "15"
nStr = BinStr & "1111"
nd Select
ext
he thing is, i dont understand why.. can someone please explain it to me?
anks!
ode:
unction BinaryConvert(convert As Integer)
nd Function
have just written a function to convert a decimal number into binary. The function works fine with just one problem, I need the
umber in eight bit binary format.
or example my code will convert the number ten into 1010. I need it to convert it so it reads 00001010. This is my current code;
ode:
ublic Function inttobin(ByVal decnum As Long) As String
im binstring As Integer
o While decnum <> 0
nstring = decnum Mod 2
ttobin = binstring & inttobin
cnum = Int(decnum / 2)
oop
nd Function
he only way I could think of achieving this was like this;
ode:
ublic Function inttobin(ByVal decnum As Long) As String
im binstring As Integer
nd Function
ut this seems a like a bad way to do it. Is there anyway I can make sure that the inttobin string is always 8 bits with any additiona
uffered bits being 0?
hanks
hanks.
How to do digital to analog or binary to decimal conversion in vb.I require the coding also as I am new to this type of
ogramming.
appreciate and thank the person who helps me to solve the above problems.
have asked this question before but I can't remember the answer (sorry). I have a text box called txtDecimal and would like to
anslate the number in there into Binary and then display it in a label called lblBinary. Could somebody please help?
hanks
hanks in advance,
hris
gards
om Cannaerts
sse@planetinternet.be
XAMPLE:
know the position of the bytes that I want to read are 41, 42, 43, 44
open and get to that as follows (it may not be the easiest way to get it but it makes it clearer to me how I get to it):
or an extra "topping", sometimes my HEX value will represent ASCII. An example is:
ow ---- thanks for letting me ask this one and thanks in advance.
e problem I'm having is writing the binary from right to left so that it'll be displayed correctly.
:
have it as,
01001101
stead of,
01100100