Grasshopper-NET Posted May 15, 2006 Posted May 15, 2006 ----- error C2653: 'MessageBoxA' : is not a class or namespace name ------ I included all the correct .NET references in my project, but somehow it doesn't distinguish between the Windows version and the .NET version. Quote
Administrators PlausiblyDamp Posted May 15, 2006 Administrators Posted May 15, 2006 Any chance of showing us some code or at least giving a few more details about what you have done / are trying to do. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Grasshopper-NET Posted May 15, 2006 Author Posted May 15, 2006 I'm trying to display an error message using System::Windosw::Forms::MessageBox::Show(); These are my headers: using namespace System; using namespace System::IO; using namespace System::Data; using namespace System::Text; using namespace System::Windows::Forms; using namespace System::Collections; /// ----------------------------------------------------------------------- ///<summary> Creates a new file in the given path or current directory /// ----------------------------------------------------------------------- static void CreateNewFile( String* filename, String* text, bool overwrite ) { StreamWriter* streamWriter; // Check to see if the user is writing over an existing file. if (File::Exists(filename) && !overwrite) { if (MessageBox::Show(S"That file exists. Would you like to overwrite it?", S"File Overwrite?", MessageBoxButtons::YesNo, MessageBoxIcon::Question) == DialogResult::No) { // Leave the subroutine return; } } // The StreamWriter must be defined outside of the try-catch block // in order to reference it in the __finally block. // Ensure that the creation of the new StreamWriter is wrapped in a // try-catch block, since an invalid filename could have been used. try { Shared (static) File class. streamWriter = File::CreateText(filename); // Write the entire contents of the text // to the StreamWriter in one shot. streamWriter->Write(text); streamWriter->Flush(); } catch (Exception* exc) { // Show the error to the user. MessageBox::Show(String::Concat(S"File could not be created or written to.\r\nPlease verify that the filename is correct, and that you have read permissions for the desired directory.\r\n\r\nException: ", exc->Message), S"File Error", MessageBoxButtons::OK, MessageBoxIcon::Error); } __finally { // Close the object if it has been created. if (streamWriter) streamWriter->Close(); } }; Quote
mskeel Posted May 15, 2006 Posted May 15, 2006 Could this be contributing? I think there is also a knowledge base article on the subject but I couldn't find a link. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.