Click here to Skip to main content
13,094,454 members (56,355 online)
Rate this:
Please Sign up or sign in to vote.
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>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\\framework\v2.0.50727\ 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\\framework\v2.0.50727\ 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 4-Mar-10 2:55am
Updated 4-Mar-10 3:41am
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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

*x is (char)'S', the first character of your string
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Try to pass "x" and not "*x" :)

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170813.1 | Last Updated 4 Mar 2010
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100