Valhalla Legends Forums Archive | .NET Platform | [c#.net] converting from dec to hex [solved]

AuthorMessageTime
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.
February 3, 2005, 8:59 PM
Myndfyr
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:
[code]
Console.WriteLine("Number 1: {0:x2}\nNumber 1: {0:X8}", 0x9e);
[/code]
the console output would be:
[code]
9e
0000009E
[/code]

:)  cheers
February 4, 2005, 12:12 AM

Search