G Guest Feb 10, 2005 #1 Hi, I want to WriteLine a number in hexadecimal ( e.g. %x ), how would I do that in C#?
S sadhu Feb 10, 2005 #2 Use the ToString() method with the correct format specifier. int x = 10; Console.WriteLine(x.ToString("x"));
Use the ToString() method with the correct format specifier. int x = 10; Console.WriteLine(x.ToString("x"));
J Jon Sagara Feb 10, 2005 #3 int nNum = 15; Console.WriteLine ("Hex: {0:X}", nNum); // F Console.WriteLine ("Hex: {0:x}", nNum); // f X produces upper case hex, x produces lower case hex.
int nNum = 15; Console.WriteLine ("Hex: {0:X}", nNum); // F Console.WriteLine ("Hex: {0:x}", nNum); // f X produces upper case hex, x produces lower case hex.
M Mark Reed Feb 11, 2005 #4 int nNum = 15; Console.WriteLine ("Hex: {0:X}", nNum); // F Console.WriteLine ("Hex: {0:x}", nNum); // f X produces upper case hex, x produces lower case hex. Click to expand... I'm a beginner, so pardon the simplicity of what I am about to ask... Using this same goal, how would you make a form to input a word and have it converted to hex and displayed in a label once a button is pressed?
int nNum = 15; Console.WriteLine ("Hex: {0:X}", nNum); // F Console.WriteLine ("Hex: {0:x}", nNum); // f X produces upper case hex, x produces lower case hex. Click to expand... I'm a beginner, so pardon the simplicity of what I am about to ask... Using this same goal, how would you make a form to input a word and have it converted to hex and displayed in a label once a button is pressed?