String* message = S"You did not enter a server name. Cancel this operation?"; String* caption = S"No Server Name Specified"; MessageBoxButtons buttons = MessageBoxButtons::YesNo; System::Windows::Forms::DialogResult result;
result = MessageBox::Show(this, message, caption, buttons);
if (result == DialogResult::Yes) { // Closes the parent form. this->Close(); }
が、 ------ Build started: Project: HomeBank, Configuration: Debug Win32 ------ Compiling... Form1.cpp c:\VCNET\HomeBank\HomeBank\Form1.h(349) : error C2665: 'System::Windows::Forms::MessageBox::Show' : none of the 21 overloads could convert all the argument types stdafx.cpp: could be 'System::Windows::Forms::DialogResult System::Windows::Forms::MessageBox::Show(System::String ^,System::String ^,System::Windows::Forms::MessageBoxButtons,System::Windows::Forms::MessageBoxIcon)' stdafx.cpp: or 'System::Windows::Forms::DialogResult System::Windows::Forms::MessageBox::Show(System::Windows::Forms::IWin32Window ^,System::String ^,System::String ^,System::Windows::Forms::MessageBoxButtons)' while trying to match the argument list '(const char [21], const char [9], const char [5], System::Windows::Forms::MessageBoxButtons)' c:\VCNET\HomeBank\HomeBank\Form1.h(349) : error C2039: 'OK_DialogResult' : is not a member of 'System::Windows::Forms::Form' stdafx.cpp : see declaration of 'System::Windows::Forms::Form' c:\VCNET\HomeBank\HomeBank\Form1.h(349) : error C2039: 'OK' : is not a member of 'Form' c:\VCNET\HomeBank\HomeBank\Form1.h(349) : error C2065: 'OK' : undeclared identifier Build log was saved at "file://c:\VCNET\HomeBank\HomeBank\Debug\BuildLog.htm" HomeBank - 4 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
使ってるnamespaceは using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; です。