473,321 Members | 1,916 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,321 software developers and data experts.

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 3412
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==handle ) {
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**************@exisconsulting.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
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
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...
2
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...
10
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...
3
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)...
0
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...
2
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...
1
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...
2
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.