G
Guest
I spent many hours on this, googling around and experimenting, and still
nothing.
I wrote an umanaged program (actually various classes), while I was
developing them I used command line to test it.
Now, I decided to make GUI for it, so I created new project: "Windows Forms
Application (.NET)" (I was trying to use something that's not managed (e.g.
MFC, but I learned quickly that I don't actually know how to use MFC
In .NET I was able to quickly create the GUI that looked as I wanted it too
look.
Now my problem is really silly. While I figured out how to convert
System::String to for example std::string, and looks like the other way
around is actually easy, I can't for a love of God make String::Format do
what I want.
Even the examples from MSDN doesn't work when I copy&paste them verbatim!
Here is an example:
http://msdn2.microsoft.com/en-us/library/fht0f5be.aspx
In a simple program that has just textbox, button and label, the following
code works:
label1->Text = String::Format("Hello, {0}", textBox1->Text);
But this, doesn't want to:
label1->Text = String::Format("Hello, {0}", 10);
My goal is basically do something like this:
unsigned short int pc = 8000;
label1->Text = String::Format("Address: {0,4:X}", pc);
Anyone has idea what I'm doing wrong?
I have also an unrelated question: If I have a managed class (for the
form), and I define inside a pointer to an unmanaged class, is that a good
practice? Right now it appears to work fine, but before I had an exception
that the pointer is null (even though I did new on the form's load, and
pointer was used after selecting an option from a menu). I have no idea how
I even fixed it.
Thanks for help.
nothing.
I wrote an umanaged program (actually various classes), while I was
developing them I used command line to test it.
Now, I decided to make GUI for it, so I created new project: "Windows Forms
Application (.NET)" (I was trying to use something that's not managed (e.g.
MFC, but I learned quickly that I don't actually know how to use MFC
In .NET I was able to quickly create the GUI that looked as I wanted it too
look.
Now my problem is really silly. While I figured out how to convert
System::String to for example std::string, and looks like the other way
around is actually easy, I can't for a love of God make String::Format do
what I want.
Even the examples from MSDN doesn't work when I copy&paste them verbatim!
Here is an example:
http://msdn2.microsoft.com/en-us/library/fht0f5be.aspx
In a simple program that has just textbox, button and label, the following
code works:
label1->Text = String::Format("Hello, {0}", textBox1->Text);
But this, doesn't want to:
label1->Text = String::Format("Hello, {0}", 10);
My goal is basically do something like this:
unsigned short int pc = 8000;
label1->Text = String::Format("Address: {0,4:X}", pc);
Anyone has idea what I'm doing wrong?
I have also an unrelated question: If I have a managed class (for the
form), and I define inside a pointer to an unmanaged class, is that a good
practice? Right now it appears to work fine, but before I had an exception
that the pointer is null (even though I did new on the form's load, and
pointer was used after selecting an option from a menu). I have no idea how
I even fixed it.
Thanks for help.