Click to See Complete Forum and Search --> : set_Text to display hex


rowgram
November 30th, 2005, 12:03 PM
I've got a textbox that I would like to display a hex number :

textbox1->set_Text(Convert::ToString(var));

How can I do this ?

In printing to a text file, I can use :

fprintf(fileX, "%#x", var);


Thanks,
ak

cilu
November 30th, 2005, 04:13 PM
Try this:

int number = 512;
StringBuilder* text = new StringBuilder();
text->AppendFormat("{0:X}", __box(number));
textNumber->set_Text(text->ToString());

rowgram
November 30th, 2005, 07:28 PM
Yes, that does it - thanks for the help.
StringBuilder.... I learn something new every day :)

Side question :
using the debugger, how can I 'watch' a variable that is out of scope without making it global ?

Regards,
ak

cilu
December 2nd, 2005, 04:03 AM
Well, if it's out of scope, it means that its life cycle ended, so that makes no sence.