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 7715821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:28:58+00:00 2026-06-01T02:28:58+00:00

private: System::Void btn_entrar_Click(System::Object^ sender, System::EventArgs^ e) { string btn_texto = txt_login->Text->ToString(); MessageBox(NULL, Hello!, btn_texto.c_str(),

  • 0
private: System::Void btn_entrar_Click(System::Object^  sender, System::EventArgs^  e) {

string btn_texto = txt_login->Text->ToString();
MessageBox(NULL, "Hello!", btn_texto.c_str(), MB_OK | MB_ICONEXCLAMATION);

}

I’m creating a windows forms application normally in Visual C++ Studio 2008 Professional, I added a click function (by double clicking in the button on the design mode) so I wrote the code inside the function it generated.

it generated 2 errors:

Error 1:

error C2440: ‘initializing’ : cannot convert from ‘System::String ^’
to ‘std::basic_string<_Elem,_Traits,_Ax>’

Error 2:

error C2872: ‘MessageBox’ : ambiguous symbol 1> could be
‘C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winuser.h(7374)
: int MessageBox(HWND,LPCTSTR,LPCTSTR,UINT)’ 1> or
‘c:\windows\microsoft.net\framework\v2.0.50727\system.windows.forms.dll
: System::Windows::Forms::MessageBox’

I’m creating in C++ on Visual Studio 2008 Professional at Windows 7 and the project under .NET Framework 3.5

Someone know how do I fix this? I looked it up all over but couldn’t find a solution.
I hope I gave enough information.
Thanks in advance.

@edit Example Given by Cody Gray

System::String btn_texto = txt_login->Text->ToString();
System::Windows::Forms::MessageBox(NULL, "Hello!", "HI", MB_OK | MB_ICONEXCLAMATION);

Errors Gotten

error C3149: ‘System::String’ : cannot use this type here without a
top-level ‘^’ error C2661:
‘System::Windows::Forms::MessageBox::MessageBox’ : no overloaded
function takes 4 arguments

So I solved the first error by adding ^ after System::String
being like this:

System::String^ btn_texto = txt_login->Text->ToString();

but the second error wasn’t fixed, and by the way, how would I add the “btn_texto” content in the MessageBox Function? 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-06-01T02:28:59+00:00Added an answer on June 1, 2026 at 2:28 am
    System::String^ btn_texto = txt_login->Text->ToString();
    MessageBox::Show( "Working", "Info",    MessageBoxButtons::OK, MessageBoxIcon::Exclamation );
    

    Solved it. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, I have: private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { DrawBackground(); } private: System::Void
public class Form1 : System.Windows.Forms.Form { private void eachCornerPix (object sender, PaintEventArgs e, out
When I write the following: private: System::Void queue_FormClosing( System::Object^ sender, System::Windows::Forms::FormClosingEventArgs^ e) { if(e->CloseReason!=CloseReason::FormOwnerClosing)
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress Dim allowedChars
i have the following code Private Sub select_color_Click(ByVal sender As System.Object, ByVal e As
this doesn't feel right Private Sub drop_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs)
I have this piece of code in c#: private static void _constructRow(SqlDataReader reader, system.IO.StreamWriter
Imports System.Data.OleDb Public Class Log Private mConnectionString As String = Provider=OraOLEDB.Oracle;Data Source=(DESCRIPTION=(CID=GTU_APP)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=xxx)(PORT=1521)))(CONNECT_DATA=(SID=xxx)(SERVER=DEDICATED)));User Id=xxx;Password=xxx; Dim
Firstly here is the code that im trying to get to work- private: System::Void
I am creating a private message system to allow users to communicate between one

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.