You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
So, I wish to:
Here is my code:
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?
The text was updated successfully, but these errors were encountered: