Why dialog is not modal How I can make it modal (I have to use delegate, otherwise my calling application is blocked.)
public delegate void OpenDialogDelegate();
public class MainForm : System.Windows.Forms.Form
{
private System.ComponentModel.IContainer components = null;
private System.Windows.Forms.Button btnShow;
private OpenDialogDelegate sDel;
public MainForm()
{
InitializeComponent();
sDel = new OpenDialogDelegate(this.OpenDialogDelegateFunction);
}
private void btnShow_Click(object sender, System.EventArgs e)
{
sDel.BeginInvoke(null, null);
}
public void OpenDialogDelegateFunction()
{
Form myForm = new Form();
Application.DoEvents();
myForm.ShowDialog(this);
}

Delegate and ShowDialog
lost in the bitzone
Try this and it would work-
private
void btnShow_Click(object sender, System.EventArgs e){
sDel();
}
james100
I kinda use this logic when bringing up splash screen.
What I do is marked the form topmost, use .Show(), set the main form to disable.
This whole process is usually accompanied by a thread(either Thread Class or BeginInvoke) that loads some data or just a delay to show the splash screen for a moment. Then I dispose the splash screen in a callback procedure.
dsm1982
If you make it modal the calling thread will be blocked. ShowDialog() is not meant to be an asynchron call.
If you really need this behaviour you need to do some programming.
If MainForm (or any other of your open forms) gets activated (Activate event) while showing the other form, set focus back to Form with a delegate to avoid cross thread UI calls.