Solved

Which forms are showed?

Posted on 2006-06-09
2
233 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

705 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