What I'm trying to do is when form2 is opening making the parent form Hide. That is none issue but when form2 is closed I want to Show the parent form again.
this.Hide();
ReadFrom form = new ReadFrom();
form.ShowDialog();
this.Show();
That only flash quickly the parent & it still stays on the screen (windows form not wpf)
1st form:
public partial class Form1 : Form
{
public Form1() { InitializeComponent(); }
private void button1_Click(object sender, EventArgs e)
{
ReadFrom form = new ReadFrom();
form.Owner = this;
this.Hide();
form.ShowDialog();
}
}
2nd form:
public partial class ReadFrom : Form
{
public ReadFrom() { InitializeComponent(); }
private void ReadFrom_FormClosed(object sender, FormClosedEventArgs e)
{
this.Owner.Show();
}
}
I swear to god I don't know how but I tried your answer Toni & Maciej Los . Both didn't work. But it guided me. I don't know why this works now but it works (might have changed a property by mistake & now it works, dunno) the code:
this.Hide();
ReadFrom form = new ReadFrom();
form.ShowDialog();
this.Show();
Sorry for the inconvenience guys.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.