Modal/Non-Modal MessageBox per Module

Topics: CAB & Smart Client Software Factory
Jun 26, 2007 at 8:16 PM
I was wondering if you can have the popup be modal/non-modal on a per module basis?

As a ** really ** rough example, if I have a form that I am entering data into and an auto save failed which creates a messagebox to pop up, I don't want to be REQUIRED to click ok. I want to be able to continue entering data into my form and then sometime later click Ok

Using the same messagebox, If I do a manual save which fails, the messagebox would popup and this time REQUIRES me to tak some action.

Thanks,
Dave
Jun 29, 2007 at 7:50 PM
Hi! A way you could do this is to create form (which would do the work of the MessageBox) and implement the show it whether with Show() (non modal) or ShowDialog() (modal).

Other solution, in case you sitill wanted to do it with a MessageBox, you could try launching the messagebox in a new thread (it would still be modal, but in other thread, so it would not stop the execution of the other one), something like:

public static void ShowNonModalMessageBox()
{
MessageBox.Show("Your message here");
}

... and then when you want to launch it ...

Thread t = new Thread(new ThreadStart(ShowNonModalMessageBox));
t.Start();

Hope it helps!

Luciano G. Panaro
http://staff.southworks.net/lpanaro