Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Hexadecimal Conversion

I'm trying to make a program that determines colors for HTML, and I am showing both RGB to Hex and Hex to RGB. Is there anything built into VB that will automatically convert between the two, or do I have to code that myself? Also, if I have to code it, how do I do it, and is there anything online already done that does this?

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Hexadecimal Value Conversion
Iím reading a file that has some records containing some hexadecimal value of 00 (xí00í); how can I replace this value with blanks. Iím trying REPLACE function, but I donít how to identify this hexadecimal value.

Thanks in advance for your help.


Conversion Of Hexadecimal Value To Number
I have converted the numeric value to the hexadecimal value using the function hex().
I want to reconvert the hexadecimal value back to the numerical value.

Conversion Binary To Binary And Conversion Of Hexadecimal To Decimal In Calculator
Hi Folks

i was develop one scientific calculator

1) binary to binary conversion= for example we can add one binary value (1110) + another binary value(0101) = i want this output(100 1 1)but it comes 1211 this is my question how can i rectify ?

2) convert from hexadecimal to decimal conversions (ex)in decimal 12 to hexa is c . it wirks good ,but my question is how to convert hexadecimal to deimal (12) ?
Tks in Advance

Conversion From Hexadecimal Back To Decimal
Hi everyone,

Does anyone know how to convert a number in hexadecimal format back to decimal? The decimal number i have is previosly processed and stored inside a integer variable, intX. So i cannot simply write &HintX. Any suggestions?


Conversion From Hexadecimal Back To Decimal
Hi everyone,

Does anyone know how to convert a number in hexadecimal format back to decimal? The decimal number i have is previosly processed and stored inside a integer variable, intX. So i cannot simply write &HintX. Any suggestions?


Hexadecimal To Decimal Conversion (stupid Text Boxes Wont Work!)
I have two text boxes, txtDecimal and txtHexadecimal. When you type into the hex box, it converts and puts the converted value in the decimal box. But, when you type stuff into the hex box, it types backwards??

I put in 12345 and it comes out 12345
put in 03ED and it comes out DE3 ??
It seems to start going backwards as soon as i use a letter
BEE comes out as EEB etc

This is driving me nuts : ) I don't know what I'm doing wrong - the code for hex - dec conversion that im using is

txtDecimal.Text = Val("&h" & txtHexadecimal)

the conversion works, but the stupid text box wont behave!!

Conversion Of Signed Digit To 8 Digit Hexadecimal In Vb6
Hi all,

i need to write a program which convert a signed digit to a 8 digit
If given a decimal number 100, i need to convert to hexadecimal as
How can i set the hexadecimal output to 8-digit?


Hi all,

What i want to do is open up a reasonably small file (64k) with vb and display its hex contents in a texttbox. How would i do this? Thanks


This is what i have so far

Private Sub Form_Load()
Dim Bytes() As Byte
Dim fileLength As Long
Dim fileName As String
Dim x As Long
fileName = "c:windowscalc.exe"
fileLength = FileLen(fileName)
ReDim Bytes(0 To (FileLen - 1))

Open fileName For Binary As #1
Get #1, 1, Bytes()
Close #1

x = 0
text1.Text = text1.Text & Bytes(x)
text1.Text = text1.Text & " "
x = x + 1
Loop Until x = fileLength

End Sub
How do i convert the array Bytes() to hex values? Thanks

Hexadecimal Help
Is there a way to tell the cdec function that the hex string is a signed int.

For Example. if I say...

hex(-1644) = F994

but convert that back to a dec and I get

cdec("&HF994") = 63892

So I need some way of converting the hex back to dec as a signed int.

The only way I have foung is to add 4F's to the front of the hex num...

cdec("&HFFFFF994") = -1644

Is this the best way or am I missing something.


Hexadecimal Big Value
Hi everone... I have this huge hexa value


do you know how I can convert it to numeric??? What is the code??


How Do I Get Hexadecimal With Vb
I have a html editor that is start to look pretty good but i need to know how to change the integer i get for a hexadeicmal number.
Is there an api that can be used or is it that i have to code all the possiblity i really hope not.
thanks peace

I am trying to extract version info using the GetVersionInfo API. I am at the point of extracting the data from the VS_VERSIONINFO structure but how do I turn

into the easy to interpret

Oh and what is a bitmask and how do hi and lo words work when using dwords?

Hexadecimal And RGB
Hi guys!!!

How can I convert a RGB value to hexadecimal and viceversa?

How can I change a decimal number to a hexadecimal number?

I know how to convert intergers to Hexa but, how do I convert hexa to integers?

Thanx in advance

Using Hexadecimal In VB?
How do I get VB to read the information from a file from a certain Hexadecimal location? So if I were to read something from a file at hexadecimal address of A5? How would I do it?


Color Conversion - Conversion Problem?
Hi all,

    I want to convert color schemes used in web to the compatible windows colors. I have a color code #EFF5FC. how do i convert it so that i can use it in vb backcolor.?


When you are laughing, you are in a state of meditation.
b'caz laughing and thinking cannot be done together.

Binary To {hexadecimal}---help!!
Does anyone have the codes for Binary to hexadecimal conversion for 32-bits?
I really need it.
Thanks in advance!!

Hexadecimal Problem
a hexadecimal number: C1EC7ED3

Converted in Visual Basic = -1041465645
Print CDec(&HC1EC7ED3)
Print CDec("&H" & C1EC7ED3)

In the Windows Calculator program = 3253501651

How come this is happening?? I want to get a result like in the calculator.

Hexadecimal Date
Dear All

I tried - unsuccessfully - to solve this apparently simple question.
From my application in VB I have imported some data from a dbf file.
One of this data is an exadecimal figure which corresponds to a Date/Time, for example: 2E9E5AC8 is compound by 2 bytes: the first (2E9E) indicates the date in short format, and the second (5AC8) indicates the time in short format.
The same documentation says that it is possible to explicit the above date and time by using two API Functions: DOSGetDateShort and DOSGetTimeShort, but I really cannot find them anywhere.

Have you got some good suggestions to retrieve the date and time in decimal notation from the above?
For yr guidance 2E9E should read 30Apr2003 5AC8 I don't know.....

Thank You to everyone
Best Regards

Binary To Hexadecimal
im looking for a sample to insert a binary file (image) to a database as text (hexadecimal/base64 encoded), ill be using this for my frontend application to update my database remotely where i also have my binary file (image) on a MySQL database.

Hexadecimal Codes
How would I print a Hex code to my Default Printer. I'm trying to Print 1B 52 n ??

Thanks in advance

DWORD Hexadecimal
How can I pass a hexadecimal value (0x00000001) for a DWORD setting value in the registry through the API function

RegSetValueEx ????

Thanks in advance!!

Hexadecimal To Decimal?
i am trying to convert a hexadecimal color to 3 seperate rgb values, buti am having trouble converting the hex value (eg FF) to a decimal number (255).

is there any simple way of doing this?

i have tried the CLng but that returns a type mismatch =/

Hexadecimal To Ascii
Hi, I've a string in hex and I need translate it to ASCII, this string comes from a cash box and contains the names off all the products in the cash box memory. Any Idea? It is a line per product but I can handle this. Only need translate a string from Hex to Ascii...

Hexadecimal Notation
In VB you specify a hexadecimal number with the prefix "&H" and upper case letters for the digits above 9, so "&H15A8" for example.

What then are the numbers that I see specified in the form "0x12be3"? Is this simply a different notation style for hexadecimal numbers? Couldn't find the answer in the help files.

Random Hexadecimal?

How can i generate a random hexadecimal and integer number?


Hexadecimal Registry Value(help Again)
is it possible to save a Hexadecimal value to the registry?

if so, how?

Hexadecimal Value Of && (ampersand)
Hi, is it possible to find out the hexadecimal value of &(ampersand)

Help! Hexadecimal Colors
I need help!
How can i get a color's number from decimel to hexadecimal?
for xample, the color 7888898 in decimel, is 786002 in hexadecimal. can some plz help me and tell me how can i get a color's number (THE SAME COLOR) in hexadecimal values?
tnx very much!

Hexadecimal Question
How would I create a key to be hexadecimal for the registry.
I tried using REG_BINARY=3, and REG_DWORD=240.
But for some reason, it doesnt come out hexadecimal.

When I try either one and look them up in the reg ( the keys i just created ) they do not have a Base option to choose decimal or hexa.

The registry keys allready in the computer do have this option. What am i doing wrong.


ps this is what im trying to fix.

Key: [HKEY_CURRENT_USERSoftwareMicrosoftCommand Processor]
Value Name: DefaultColor
Data Type: REG_DWORD (DWORD Value)
Value Data: (0 = default)

For some reason mine stays binary.

[Edited by help on 01-04-2001 at 11:39 PM]

Hexadecimal To Long
How can I transform a hexadecimal string in a textbox to a long?

Doing Hexadecimal Math
I am trying to make a program that will do math in the Hexadecimal system but I have no idea how to set it up to do the math in Hex.

Here's a more detailed explination of what I want to do:

The user inputs an 8-digit hexadecimal into a text field, then there are 6 buttons. By clicking 1 of the buttons, it subtracts a hexadecimal value specified by the button (ex. 4C0) from the inputed value and displays it in another text field.

Could somebody assist me in making this over AOL or something? Or be a really nice person and make the program for me? I could do some graphics for you if you wanted in exchange... anything in web design I can do...

AOL Name: Kukyfrope2
IM me if you can or want to try and help me!


Hexadecimal Variables???????
I have inside of string a hexadecimal value:


Its long is nerly to 4090 characters. This string update a hexadecimal fields in a table. When I need update this field using this string, its is converted in other value, of course, its is a string and not hexadecimal value. In the update moment this makes a converts to hexadecimal value. If I try convert this string to decimal, when had pass 200 characters occurs a overflow error, using a double, its value is over 1.79.....E+308. I think that using a Hexadecimal Variable, the update do not make a convert, and take this value, inside of the variable as hexadecimal value to upate.
Please. Are there some way to declarate a hexadecimal value. Or to converts from too long or bigger Hexadecimal to decimal value????
Thanks to all!!!!!!!!!!1
Juan Carlos Chacůn

How To Convert A 8 Bit Value Into Hexadecimal Using Vb6
I want to know the code to convert a 8 bit value into hexadecimal value using vb6. Please help me in coding.
Thanks in advance


How To Represent A Hexadecimal Value In VB
Hello gurus,

How do you represent hexadecimal value in visual basic.
Take for example, what is the equivalent VB code of the C/C++ code below:


long color;
color = RGB(0x99, 0xCC, 0xFF);

Thanks in advance.


Hexadecimal As String In VB
Can someone explain how to return a string representation of a hexadecimal GUID in VB? In sql server the datatype is stored as binary with length of 16. When I run a query in sql server the result displays a hexadecimal with 32 characters. When I run this query from VB and display the result in VB I get "A??". I looked up MSDN and it told me that I need to store the hexadecimal as a binary array eg. dim arrayHex() as binary. I then build a string using the hex function hex(arrayHex(i)) for each element in the array, 16 elements in total. The result is a hexadecimal string representation of 24 characters instead of 32. I guess I do not fully understand hexadecimals. Thank you for any advice for this in advance.

Hexadecimal As String In VB
Can someone explain how to

In sq

Hexadecimal Color
Is it possible to use hex values consistently in run-time mode? I can use decimal 255 for red, but blue and green get converted wrong. I know about the RGB(r,g,b) command, but it's in decimal, and intellisense converts txtText.ForeColor = &H0000FF& to &HFF& ... any suggestions? Am using VB 6.0. Also, how to turn off Intellisense in VB?

Norman Spears

Reading A File In A Hexadecimal!!!
How can i read a file in hexadecimal?

How To Convert Hexadecimal To Decimal
how to convert hexadecimal to decimal

How To Convert Hexadecimal To Int In Vbscript?
hi, can anyone plz answer -- how to change for example the hexadecimal 9fc01ea5 ( written as 0x9fc01ea5 in C ) to int in vbscript?

Hexadecimal Reference Values
I was wondering if anyone knew where I could find the hexadecimal reference values for the Open Dialog Box. I am looking to use an API but was needing to know what the reference values were for each of the components of the dialog box is. If anyone could help me, I thank you.

Hexadecimal Values For Vb Colors
Does anyone know the hexadecimal values for the vb colors?

Like vbBlack, vbRed, vbBlue, vbGreen, etc.


Read A File Hexadecimal
Hi, I want to read out a file.
But I want the hexadecimal values for each byte.

I can't just read it out normally and convert the returning characters to hex, because every character VB doesn't know, it converts to question marks (?).

Has anybody a suggestion on how to do that?

Aanother thing: Has VB an Assembler? Maybe I can try to assemble something....

String -> Hexadecimal && Another Question
Is it possible to convert a string into a hexadecimal value?

Other question: In php there's a function called MD5. It encrypts a string so that it's not decryptable. Does a similiar function exist in VB? Or are there other encryption functions (decryptable or not)?

Hexadecimal Regedit Store?
is that possible?
may i write regedit values in HEX?
i just can write them like strings

i use this module:


Public Sub CreateKey(Folder As String, Value As String)

Dim b As Object
On Error Resume Next
Set b = CreateObject("")
b.RegWrite Folder, Value

End Sub

Public Sub CreateIntegerKey(Folder As String, Value As Integer)

Dim b As Object
On Error Resume Next
Set b = CreateObject("")
b.RegWrite Folder, Value, "REG_DWORD"

End Sub

Public Function ReadKey(Value As String) As String

Dim b As Object
On Error Resume Next
Set b = CreateObject("")
r = b.RegRead(Value)
ReadKey = r
End Function

Public Sub DeleteKey(Value As String)

Dim b As Object
On Error Resume Next
Set b = CreateObject("Wscript.Shell")
b.RegDelete Value
End Sub
sorry my fault!!! this module is the corroct one!

Vb6 Changing The Backcolor Using Hexadecimal
here's my propblem .....

I have a text box with a hexadecimal code in such as '#00ff00'.
I also have a command button. Whn i click that button i want its back color to change to the color of the code in the text box.
Can it be done and if so, how?

all help appreciated.

Copyright © 2005-08, All rights reserved