Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

How focus on winform if already opened?

$
0
0

I need to focus on form if it is already opened else i want to open new form.

I am trying but not working.

 foreach (var item in Application.OpenForms)
            {
                Form form1 = item as Form ;
                if (form1 != null)
                {
                    form1.Activate();
                    break;
                }
                else
                {
                    form1 = new Form ();
                    form1.Show();
                    break;
                }

            }


Viewing all articles
Browse latest Browse all 31927

Trending Articles



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