Click to See Complete Forum and Search --> : MessageBox method


CooLWong
July 16th, 2007, 03:34 AM
I using Visual C++ express edition 2005, when i click a button, it will shown a messagebox. I can write a simple code to show it, but it don hav error message, warning message, or information message.

This is my simple code:


private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
System::Windows::Forms::MessageBox::Show("Example", "YA");
}


Any body can help me to change the code to show the error message or warning message???

laitinen
July 16th, 2007, 04:01 AM
Hi!

Take a look here: MessageBox.Show Method (http://msdn2.microsoft.com/en-us/library/system.windows.forms.messagebox.show.aspx)

There are lots of different solutions ready for you!

Cheers,

Laitinen

Vidya.p.nair
July 16th, 2007, 06:53 AM
You can use the AfxMessageBox("Message"); in case of Visual c++6.0

Marc G
July 16th, 2007, 02:01 PM
[ moved thread ]

Sahir
July 17th, 2007, 03:10 PM
.. it will shown a messagebox. I can write a simple code to show it, but it don hav error message, warning message, or information message. ...

Is this what you require ?


MessageBox::Show("hello" , "test" , MessageBoxButtons::AbortRetryIgnore,
MessageBoxIcon::Error);
MessageBox::Show("hello" , "test" , MessageBoxButtons::AbortRetryIgnore,
MessageBoxIcon::Information);

CooLWong
July 17th, 2007, 08:17 PM
Is this what you require ?


yaya... i can work wif the sample code. Thanks.