Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Open form

$
0
0

I want to close and open the same form again. My code is 

            Form2 fm = new Form2();
            this.Hide();
            fm.ShowDialog(ParentForm);
            this.Close();

The problem is that initially form1 which is the main form looses focus. But when i manually focus it  on the first call of Form2  the code works perfect from there on. Please help, what is causing my Form1 to loose focus on the first call of Form2 

and Form2 comes on top of other windows instead of Form1.


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>