473,387 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Only one MDI child at a time

I have an MDIParent form and when I click on a menu item, it opens up a child
form. However, if I click the menu item again, it opens up a second version
of the form. How can I make sure that only one version of this form is open
at a time?
Nov 17 '05 #1
2 3156
cashdeskmac wrote:
I have an MDIParent form and when I click on a menu item, it opens up a child
form. However, if I click the menu item again, it opens up a second version
of the form. How can I make sure that only one version of this form is open
at a time?

When you click on the menu to open an MDI child, check if such a child already exists.
bool bOpen = false;
foreach (Form f in this.MDIChildern)
if (f.Name == "YourFormName")
bOpen = true;
if (!bOpen)
*Open Your Form*
Hope it helps,
Andrey
Nov 17 '05 #2
"MuZZy" <le*******@yahoo.com> wrote in message
news:d7********************@comcast.com...
if (f.Name == "YourFormName")


Better to use

if (f is YourFormName)

that way if you mistype YourFormName the compiler will pick it up.

Michael
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Caroline | last post by:
I seem to always want to do this type of join, but I can never find how to do this. I am trying to join two tables. The parent table will always have one row of data and the child may have 0 to...
16
by: Suzanne Vogel | last post by:
Hi, I've been trying to write a function to test whether one class is derived from another class. I am given only id's of the two classes. Therefore, direct use of template methods is not an...
8
by: mike | last post by:
I have a parent window where I open a child window. In that child window I have some js that creates a row in the parent window, it looks like: if ( self.opener.document.update ) { var...
1
by: George W. | last post by:
Okay, I'm a C#/XML newbie, and I've been wrestling with this for a while now, checked dotnet sites, articles, MSDN Library, etc. and haven't been able to determine why this is happening. I have...
22
by: codefixer | last post by:
Hi, I have a situation where I have to handle the following scenario. The main() must wait for child to complete or the main() must kill the child after 3 seconds and exit. /* Assume...
1
by: Bill Borg | last post by:
Hello all, Simple chat app, where the site owner has a master window with all requests for chat, status of each room, etc., and child windows for each separate chat in which the owner is...
4
by: LCAdeveloper | last post by:
Help! Another newbie question I'm afraid. I have a toolbar on an MDI form, which I can control OK to produce a child form. When the child form is active, the appropriate MDI parent form toolbar...
3
by: zacks | last post by:
Forgive me if this has been already asked an answered, I did do a search both here and in VS2005 Help, but I can't find the answer to my question. I am developing an MDI application that is a...
4
by: ToxSox | last post by:
Hello. This is my first post here and i have a big problem with my script! One page (child.htm), was delivered not by me and i can't change it. This page calls a methode in a object of my page....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.