• Welcome to Valhalla Legends Archive.
 

[c#.net] converting from dec to hex [solved]

Started by mentalCo., February 03, 2005, 02:59 PM

Previous topic - Next topic

mentalCo.

This is a simple and dumb question.  I can't get a dec value to display hex in a rich text box. 

[edit]

solved it using '.ToString("x")'  im a retard.

MyndFyre

#1
Just a side note, you can use "x2" or the like to specify the number of left-padded 0s to include.  For example, if you have the number 0xe0543, and you call .ToString("x8"), it will format 000e0543.  Capitalizing the X results in capital letters in the number.  ;)

The same rules can be applied to String.Format -- if you use the command:

Console.WriteLine("Number 1: {0:x2}\nNumber 1: {0:X8}", 0x9e);

the console output would be:

9e
0000009E


:)  cheers
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.