Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4539444
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:56:51+00:00 2026-05-21T14:56:51+00:00

I am building a project in C++/CLI where in I have to show a

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T14:56:52+00:00Added an answer on May 21, 2026 at 2:56 pm

    Your problem is thar std::string is unmanaged and cannot be assigned to managed System::String. Solution is marshalling. See this MSDN page: http://msdn.microsoft.com/en-us/library/bb384865.aspx

    So here is the solution (for Visual Studio):

    #include <msclr/marshal_cppstd.h>
    
    // ...
    
    std::string stringPart = "ABC";
    int intPart = 10;
    
    String^ msg = String::Concat("Message", msclr::interop::marshal_as<System::String^>(stringPart));
    msg = String::Concat(msg, intPart);
    MessageBox::Show(msg);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using qmake for building a project of mine. I have been trying to
Let's imagine I already have a project building .NET 3.5 assembly. Now I want
I have a bit of a problem building my project. I'm getting the bellow
I have different behaviour of compiler, when building project from IDE and from command-line,
I am getting the following error when building my project and have no idea
I am building a project in VS2005 and several of my DLLs are failing
when I was building my project done in ASP.NET and C#, it produced the
I'm building my project with maven so according to maven way, config should be
I am building a project in Visual C++ 2008, which is an example MFC-based
I am using Maven with Nexus for building my project with hudson ci. Everytime

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.