I have a save file dialog set up to display but when I click off of it the dialog it disappears into the background without a tab or anything. My question is how do I make the dialog modal? If you don’t know what I mean go into notepad hit save as and try to click off the dialog. You will see the window flashes and you get a nice sound informing you that you must do something in the dialog before doing anything else. I would like to achieve this effect with my dialog but I don’t know how. I cannot simply use the Form.Modal property because that deals with forms and this isn’t a Form. Could someone help me out here?
Thanks.
EDIT:
This is how I’m showing the dialog, it’s running in XNA and when I click the save as button the EntrySelected() method is called:
private void EntrySelected(object sender, EventArgs e) {
if(sender == saveAsEntry) {
sfd = new SaveFileDialog();
thread = new Thread(ShowSaveDialog);
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
}
...
}
private void ShowSaveDialog() {
if(sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
World.Save(sfd.FileName);
thread.Abort();
}
else {
thread.Abort();
}
}
Actualy your Dialog is a Form, As the above comment suggests there is not a Show method, you should be using ShowDialog() Command that opens it up as a Modal Dialog.
i.e.
Base on your edit, there is a version of ShowDialog where you assign the owner to the Dialog, maybe that will work for you.
From above link: