Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hexa to decimal

Status
Not open for further replies.

tek1ket

MIS
Jan 25, 2009
70
IR
how can i convert a hexadecimal float number to decimal number?
like 4E73 in hexadecimal to decimal?
 
Something like:
Code:
int decVal = Convert.ToInt32(myHexValue, 16);
Hope this helps

HarleyQuinn
---------------------------------
Black coat, white shoes, black hat, cadillac. The boy's a timebomb!

You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before post
 
it cannot parse 4.0E+73 the number in hex has been shown in exponents notation. so it cann't convert it
any other idea
 
how the data is presented and the type of value are independent. if the value is hex then you can convert it using Convert.ToX().

it may be the value is not a hex, but a string or something else. to figure out the type do something like
Code:
var hex = GetHex();
Console.WriteLine("hex is: {0}", hex.GetType().Name);
var dec = Convert.ToDecimal(hex);
Console.WriteLine("hex decimal value is {0}", dec);

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
Code:
string num = "4E73";
int conv = int.Parse(num, System.Globalization.NumberStyles.HexNumber);
MessageBox.Show(conv.ToString());
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top