I am trying to display myValue in the MessageBox. I use C++ 2008.
How is this possible. It seems that MessageBox in this case only can display a string, "".
int myValue = 0;
double myVal2 = 3.14;
myValue = myVal2;
MessageBox::Show(myValue);
I am trying to display myValue in the MessageBox. I use C++ 2008.
How is this possible. It seems that MessageBox in this case only can display a string, "".
int myValue = 0;
double myVal2 = 3.14;
myValue = myVal2;
MessageBox::Show(myValue);
I think Prelude has examples of string streams in the f.a.q. It's something like;
std::stringstream blah;
blah<<myValue;
std::string myMessage;
myMessage=blah.str();;
You can't use the sstream directly (I don't think you can, but perhaps you can), so you'd tranfer that to a std. string for display -
I did try the code above but this didn´t work and it couldn´t convert stringstream to System::String ^ (VC++ 2008)
However, the real thing that I need to make function is to in the same way display an integer, double etc.. in a "TextBox".
The same example follow like this.
It must be possible in an easy way to display ex:
int Number = 5; in the texbox ? This do display: TextLine but this is a string. One question here is that perheps it should be written something else instead of ->Text as this only can display text.
textBox3->Text = "TextLine";
Last edited by Coding; 01-26-2008 at 08:52 AM.
Elysia,
I have to ask as I am quite new to C++, the differeces.
I downloaded VC++ 2008 Express Editon from this link but assume you already understood that:
http://www.microsoft.com/express/vc/
When you speak about if C++ Native will be okay for me I don´t really know what to refer to really
and what Native stands for. I know that you write Native code etc...
Is there any limitatons using the edtion that I do. I don´t know.
I am up to program a Windows application.
I am really open to listen to alternatives to understand better. Perheps the version of 2005 is better.
I don´t know how many different editions there are. However I would like to use C++ and not C#.
I think I begin my question like this.
C++ dot net, what is that. I am not sure if I follow here...
Last edited by Coding; 01-26-2008 at 12:22 PM.
The version makes no difference. C++ dot net works on Microsoft's dot net platform. However, C++ dot net is not standard, so it will only work on Windows, while other languages such as C# is standard and will work on other platforms, as well. So C++ dot net is what we call vendor lock-in and therefore is to be avoided.
Native C++ is much more low level and more complex than dot net and creating GUI can be a difficult process. If you are satisfied with this, then you'll have to be prepared to spend a lot of time and studies on the language to understand it. Also note that making GUIs in C++ is a no-no from the start. Instead we work on typical CLI applications to master the language first. Programming GUI in C++ is a difficult beast.
In case you want to do GUI from the get-go, then I suggest looking the other way at other programming languages such as C#.
I see, I think you meen by GUI, Graphical user interface.
It will be okay for me for now that the program is just working on Window platforms and I will only for this application do very "easy" stuff like putting values into texboxes write a value into a textbox to make a calculation. Display numbers and results in a gridview.
Reading and writing to files.
Save a file and open a file. This is quite what I will do. So It is kind of basic. No graphics or things like this. Only calculations.
What do you think. Will the editon I use now be okay for this as I have learned a lot and also already done much basic code in the program, about 30 pages...huhh...
Sorry for asking so much but to understand easier.. C# is good because it it compatible with other platforms. The basics is the same as you say, wich is interesting ofcourse.
So my question is except this. Is it easier to do window applications using C#. I red somewhere that C# i easier to use also.
Should Visual C# 2008 Express Edition be a good idéa ?
C# is better than C++ dot net because it's not a vendor lockin. It's a standard and therefore compilers will emerge to compile the code on other platforms. Like C/C++.
Since you want to do GUI, I recommend C# due to it being easy to do GUI in. So yes, the C# 2008 Express Edition should do fine.
What is the difference between Native C++ and C# you might ask? C# is driven by a huge framework, which slows down performance. It also has problems communicating directly with hardware due to its nature. But it's far easier to use.
So performance and flexibility is C++'s area, and GUI and easiness is C#'s area.
okay I think I understand better. As performace is very important for this program as it does calculations that could take more than 10 hours perheps I think a bit what will be best.
Perheps I will experiment with both to see actual difference on that one...
Thank you for all information anyway...
It doesn't look like anyone answered your original question.
A message box can only display a string, so you have to convert your number to a string. Something like:Just make sure your msg buffer is big enough.Code:char msg[32]; sprintf( msg, "%d", myValue ); MessageBox::Show(msg);
This is bad. This is C++ dot net, not managed.
I'm not sure it will accept a char[] array instead of String^.
There are ways to do that inside the .net framework.
But wait until the OP decides on what language to use and post questions later to answer.