hi,
here i am write the code for decimal value to hex value.Now my requirement is how to convert hex value to decimal value using windows application code in c#.Please find this code as given below.
thank u
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Manish Kumar ChoudharyRank #339 · 7.4K reputationPosted Dec 3, 2014, 10:22 PM EST
plz accept the ans incase it helps u.
Thanks
Manish Kumar ChoudharyRank #339 · 7.4K reputationPosted Dec 3, 2014, 8:36 PM EST
To convert from Hex to Decimal do either...
string hexValue = decValue.ToString("X");int decValue = Convert.ToInt32(hexValue, 16);
Naidu AMMAN33 reputationPosted Dec 3, 2014, 8:45 PM EST
Manish Kumar ChoudharyRank #339 · 7.4K reputationPosted Dec 3, 2014, 8:48 PM EST
Use like this string hexValue = decValue.ToString("X");int decValue = Convert.ToInt32(hexValue, 16);
Manish Kumar ChoudharyRank #339 · 7.4K reputationPosted Dec 3, 2014, 9:02 PM EST
it it work for u ?
Naidu AMMAN33 reputationPosted Dec 3, 2014, 9:07 PM EST
Naidu AMMAN33 reputationPosted Dec 3, 2014, 9:11 PM EST
Manish Kumar ChoudharyRank #339 · 7.4K reputationPosted Dec 3, 2014, 9:19 PM EST
find the attachment and check it may help u
Naidu AMMAN33 reputationPosted Dec 3, 2014, 9:32 PM EST
sir we can given "7e" it show the 126.
when i am giving the "7e a0 2b 41" its getting error in
int decValue = int.Parse(hexValue, System.Globalization.NumberStyles.HexNumber);
An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll.
sir it possible to show this data like this "7e a0 2b 41"
Manish Kumar ChoudharyRank #339 · 7.4K reputationPosted Dec 3, 2014, 9:37 PM EST
It's possible but you have to extract particular string from that textbox. Means to say u have to take every value of string inside textbox when space came and convert each of them separately convert. accept the ans if it help uNaidu AMMAN33 reputationPosted Dec 3, 2014, 9:53 PM EST
how to convert each of them separately sir.
Manish Kumar ChoudharyRank #339 · 7.4K reputationPosted Dec 3, 2014, 10:00 PM EST
string hexValue = textBox1.Text;//.ToString("X");
Naidu AMMAN33 reputationPosted Dec 3, 2014, 10:05 PM EST