473,796 Members | 2,720 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unique references to MDI children

BVO
I need to keep track of my MDI child forms to activate
any one of them whenever I need to.

There are two possibilities as far as I can see:

- each forms index in the MDIChildren collection
- each forms Handle property.

The first one doesnt offer my a unique reference cause
the indexes change when forms are closed. I guess I
should use the Handle but how do I activate a form based
on its Handle?

Any other way?

BVO

Nov 15 '05 #1
3 3425
Try this (assumes that you know the Handle if the form to activate and it is
stored in a variable called handle)

foreach ( Form frm in MdiChildren ) {
if ( frm.Handle==han dle ) {
frm.Activate();
break;
}
}

"BVO" <be************ **@shipnet.no> wrote in message
news:0b******** *************** *****@phx.gbl.. .
I need to keep track of my MDI child forms to activate
any one of them whenever I need to.

There are two possibilities as far as I can see:

- each forms index in the MDIChildren collection
- each forms Handle property.

The first one doesnt offer my a unique reference cause
the indexes change when forms are closed. I guess I
should use the Handle but how do I activate a form based
on its Handle?

Any other way?

BVO

Nov 15 '05 #2
BVO,

You could always use a Hashtable to keep track of the instances. Each
MDI child should generate a unique hashcode, so you could place the MDI
children into a Hashtable. Then, instead of getting the handle, you could
just check to see if the key exists in the hash, and if it does, then
activate the form.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni************* *@exisconsultin g.com

"BVO" <be************ **@shipnet.no> wrote in message
news:0b******** *************** *****@phx.gbl.. .
I need to keep track of my MDI child forms to activate
any one of them whenever I need to.

There are two possibilities as far as I can see:

- each forms index in the MDIChildren collection
- each forms Handle property.

The first one doesnt offer my a unique reference cause
the indexes change when forms are closed. I guess I
should use the Handle but how do I activate a form based
on its Handle?

Any other way?

BVO

Nov 15 '05 #3
assign different name/text or something else to each of the forms (or
declare public string/int and give each form different value)
"BVO" <be************ **@shipnet.no> wrote in message
news:0b******** *************** *****@phx.gbl.. .
I need to keep track of my MDI child forms to activate
any one of them whenever I need to.

There are two possibilities as far as I can see:

- each forms index in the MDIChildren collection
- each forms Handle property.

The first one doesnt offer my a unique reference cause
the indexes change when forms are closed. I guess I
should use the Handle but how do I activate a form based
on its Handle?

Any other way?

BVO

Nov 15 '05 #4

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

Similar topics

8
2895
by: Roger Leigh | last post by:
Hello again, I have a bit of a strange problem here. This code works OK: class foo { public: foo(int **ref): m_ref(ref) {}
3
5655
by: Christine McGavran | last post by:
I have created an xml format for describing a custom user interface. My application successfully parses and displays the UI described in xml files created in that format. Before today we were using Visual Studio .net 2002. I created a schema file to describe my xml so that I could use the fancy xml editing capabilities in the Visual Studio enviroment. With this schema referenced, I could auto-complete while scripting xml for my user...
2
7984
by: Earth Worm Jim | last post by:
I have been able to get simple circular references to be serialized in xml by using the ImportTypeMapping method on the SoapReflectionImporter class. But I am unable to serialise circular references when the circular reference is contained with in a collection class, specifically I am using a custom ArrayList object. I keep getting a StackOverFlow Exception from the XmlSerializer class when attempting the serialisation. The classes...
10
26143
by: BuddhaBuddy | last post by:
Platform is DB2/NT 7.2.9 The table was created like this: CREATE TABLE MYTEST ( MYTESTOID bigint not null primary key, FK_OTHEROID bigint not null references other, FK_ANOTHEROID bigint not null references another, FK_LASTLYOID bigint not null references lastly, unique (FK_OTHEROID,FK_ANOTHEROID))
3
2601
by: Chris | last post by:
Before I started to create table, etc to track unique form field record number assigments I thought I'd check to see if there is now a better way to do this in .NET. I have a parent form (table) and children form (table). Relationship equals one to many. I'd like to auto number the fields accordingly and traditionaly I assign a unique number based on a table value that I retrieve + 1. i.e. Parent record field value = 1 Children record...
0
1197
by: Dennis Gearon | last post by:
Given: CREATE TABLE Usrs( usr_id SERIAL NOT NULL PRIMARY KEY, usr VARCHAR(64) NOT NULL UNIQUE ); CREATE TABLE Emails( email_id SERIAL NOT NULL PRIMARY KEY, email VARCHAR(128) NOT NULL UNIQUE );
2
3022
by: Benjamin Smith | last post by:
I have two tables like following: create table attendancereport ( id serial unique not null, staff_id integer not null references staff(id), schoolyear varchar not null references schoolyear(year), students_id integer not null references students(id) ); // schoolyear.year in format "2003 - 2004".
1
3778
by: ken_knee | last post by:
I have a PARENT/CHILD I'm attempting to attach another CHILD to. When I try to add a FOREIGN KEY to the 3rd table referring to CHILD1 (AGTERNS), I get error SQL0573N A column list specified in the references clause of constraint "RCAGTRNZ" does not identify a unique constraint of the parent table "VCSTSTNT.AGTERNS". Since CHILD1 has multiple constraints, a unique index and a foreign key, is there a gotcha that I'm not aware of? Thanks...
2
15087
by: rorajoey | last post by:
Violation of UNIQUE KEY constraint 'IX_surveyQuestions'. Cannot insert duplicate key in object 'dbo.surveyQuestions'. This might seem like a simple matter of trying to insert a row with ID=20 when there's already one with that ID, but the problem is a bit more complicated. The table is supposed to auto-increment the value for the primary key when a new record is inserted. But no matter what I do, I can't seem to insert more than one record...
0
9673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9524
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10449
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10217
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10168
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9047
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5568
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.