Solved

Which forms are showed?

Posted on 2006-06-09
2
231 Views
Last Modified: 2010-04-16
Hi!
I have a question:
In mainform 's source code, how can I know which other forms are showed, and how can I control these forms from mainform, such as calling a method in each of these forms?

Plz help me!
Thank you very much.
0
Comment
Question by:tunhien
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 1

Accepted Solution

by:
mrsreeraj earned 300 total points
ID: 16875571
Check this link out
http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c4c.aspx

within MDI form use this code
===================
child form is MyChildForm

MyChildForm childForm = null;
    foreach(Form f in this.MdiChildren)
     {
          if(f is MyChildForm)
          {
               // found it
                childForm = (MyChildForm) f;
                break;
           }
      }
      if( childForm != null)
      {
           childForm.Show();
           childForm.Focus();
      }
      else
      {
           childForm = new MyChildForm();
           childForm.MdiParent = this;
           childForm.Show();
           childForm.Focus();
      }
 
0
 
LVL 1

Expert Comment

by:mrsreeraj
ID: 16875585
or u could use singleton pattern
example code is here
http://www.codeproject.com/csharp/singletonforms.asp
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question