I am building a project in C++/CLI where in I have to show a message box in one of my forms.
The content has to be a combination of std::string and int.
But I am not able to get the right syntax.
I tried the following:
std::string stringPart = "ABC";
int intPart = 10;
MessageBox::Show("Message" + stringPart + intPart);
I also tried:
String^ msg = String::Concat("Message", stringPart);
msg = String::Concat(msg, intPart);
MessageBox::Show(msg);
Can someone please help me with the syntax.
Thanks.
Your problem is thar
std::stringis unmanaged and cannot be assigned to managedSystem::String. Solution is marshalling. See this MSDN page: http://msdn.microsoft.com/en-us/library/bb384865.aspxSo here is the solution (for Visual Studio):