Solved

Which forms are showed?

Posted on 2006-06-09
2
227 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
  • 2
2 Comments
 
LVL 1

Accepted Solution

by:
mrsreeraj earned 300 total points
Comment Utility
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
Comment Utility
or u could use singleton pattern
example code is here
http://www.codeproject.com/csharp/singletonforms.asp
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now