-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Description
So, I wish to:
- Open an OpenFileDialog
- After closing the OpenFileDialog immediately open another custom dialog
Here is my code:
using Modern.Forms;
using System.Drawing;
namespace ModernFormsApp1
{
public partial class MainForm : Form
{
public MainForm()
{
this.Shown += async (_, _) =>
{
var ofd1 = new OpenFileDialog
{
Title = "Open this file 1"
};
await ofd1.ShowDialog(this);
await new DialogForm().ShowDialog(this);
};
}
}
public class DialogForm : Form
{
public DialogForm()
{
Text = "Dialog Form";
Size = new Size(500, 250);
var button3 = Controls.Add(new Button
{
Text = "DialogResult.Abort button",
Left = 10,
Top = 124,
Width = 250,
DialogResult = DialogResult.Abort
});
var button4 = Controls.Add(new Button
{
Text = "DialogResult.None button",
Left = 10,
Top = 164,
Width = 250,
DialogResult = DialogResult.None
});
}
}
}
When I run the code the OpenFileDialog is opened, but when I close it I get a blank dialog screen:

However when I change the order of dialogs (first opening the custom dialog and then the OpenFileDialog) it runs ok.
What am I doing wrong?
Metadata
Metadata
Assignees
Labels
No labels