Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VC6 VC7 VC7.1 VC8.0
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 4-Mar-10 3:55am
Edited 4-Mar-10 4:41am
v2
Rate this: bad
good
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
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Try to pass "x" and not "*x" Smile | :)
  Permalink  
v2

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

  Print Answers RSS
0 OriginalGriff 6,569
1 Sergey Alexandrovich Kryukov 6,168
2 DamithSL 5,228
3 Manas Bhardwaj 4,717
4 Maciej Los 4,150


Advertise | Privacy | Mobile
Web01 | 2.8.1411022.1 | Last Updated 4 Mar 2010
Copyright © CodeProject, 1999-2014
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