Click to See Complete Forum and Search --> : How to Make Message Box as Modal


harishkumara
February 9th, 2005, 10:19 PM
HI,

Iam using the MessageBoxes in my Appliation. These Message Boxes are used to display the Exception messages encountered during the User Operation on the Application.

MessageBox.Show(Message,Title,Buttons,Icons);

These MessageBoxes are displaying the messages in Modeless Way, i want these MessageBoxes to be Modal. Please suggest a way to achieve the same.

Thanks in Advance,
Harry

NigelQ
February 9th, 2005, 11:55 PM
You need to call the other Show method that supplies a parent for the MessageBox dialog to have it behave in a modal way.

The method I'm describing has the parent described as a "IWin32Window" data type in it's first parameter.

Obviously the parent specified should be the parent window you want this to be a child of.

Hope this helps,

- Nigel

harishkumara
February 21st, 2005, 10:23 PM
Thanks for ur reply.

I had used the other way. Something like this,

DialogResult dlgResult = MessageBox(Message,Title,Buttons,Icons);

This makes the Message Box Modal and can be used to check the User Choice also.

Harry

Andy Tacker
February 22nd, 2005, 01:51 AM
DialogResult dlgResult = MessageBox.Show(Message,Title,Buttons,Icons);