Click here to Skip to main content
15,896,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I think i am facing an error in conversion, so please help me out from here


char *x="SHOW ME PLEASE";
MessageBox::Show( *x, "Name Entry Error", MessageBoxButtons::OK, MessageBoxIcon::Exclamation );

It shows error :
1>------ Build started: Project: convert, Configuration: Debug Win32 ------
1>Compiling...
1>convert.cpp
1>c:\users\inder\documents\visual studio 2008\projects\convert\convert\Form1.h(104) : error C2665: 'System::Windows::Forms::MessageBox::Show' : none of the 21 overloads could convert all the argument types
1> c:\windows\microsoft.net\framework\v2.0.50727\system.windows.forms.dll: could be 'System::Windows::Forms::DialogResult System::Windows::Forms::MessageBox::Show(System::String ^,System::String ^,System::Windows::Forms::MessageBoxButtons,System::Windows::Forms::MessageBoxIcon)'
1> c:\windows\microsoft.net\framework\v2.0.50727\system.windows.forms.dll: or 'System::Windows::Forms::DialogResult System::Windows::Forms::MessageBox::Show(System::Windows::Forms::IWin32Window ^,System::String ^,System::String ^,System::Windows::Forms::MessageBoxButtons)'
1> while trying to match the argument list '(char, const char [17], System::Windows::Forms::MessageBoxButtons, System::Windows::Forms::MessageBoxIcon)'
1>Build log was saved at "file://c:\Users\Inder\Documents\Visual Studio 2008\Projects\convert\convert\Debug\BuildLog.htm"
1>convert - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Actual full error is this, i am waiting for response...

Thanks in advance,
Posted
Updated 4-Mar-10 3:41am
v2

Try this:
MessageBox::Show( x, "Name Entry Error", MessageBoxButtons::OK, MessageBoxIcon::Exclamation );

*x is (char)'S', the first character of your string
 
Share this answer
 
Try to pass "x" and not "*x" :)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900