Is an array of forms possible? 
Author Message
 Is an array of forms possible?

I have a number of MDIChild forms that I have to cycle through. Instead
of refering to them as MyForm1, MyForm2, etc. is there a way I can refer
to them as MyForm(Index) or something similar?


Wed, 07 Apr 2004 12:07:22 GMT  
 Is an array of forms possible?
On Sat, 20 Oct 2001 04:07:22 GMT, Binky Malone

Quote:
>I have a number of MDIChild forms that I have to cycle through. Instead
>of refering to them as MyForm1, MyForm2, etc. is there a way I can refer
>to them as MyForm(Index) or something similar?

Dim Frm as Form
For Each Frm In Forms
        If Not Frm Is <your mdiform> Then
                'process the form however you like here
        End If
Next

        It's air code, but it should work just fine.

        J.
        Jeremiah D. Seitz
        Porch karaoke king and the guy who runs with 8< scissors >8
        Omega Techware
        http://omegatechware.hypermart.net



Wed, 07 Apr 2004 15:11:13 GMT  
 Is an array of forms possible?
Read about the Form collection.

But you can use:

dim x as form ' set x to be of type form

for each x in forms ' look in the forms collection and exctract one x (form)
with each pass round the loop
   debug.print x.name ' print the name of the form in the debug window.
next ' get the next form (if there is one)

There are other ways also but this might do what you want


Quote:
> I have a number of MDIChild forms that I have to cycle through. Instead
> of refering to them as MyForm1, MyForm2, etc. is there a way I can refer
> to them as MyForm(Index) or something similar?



Wed, 07 Apr 2004 15:18:29 GMT  
 Is an array of forms possible?
You can use the "Tag" property of a child form to hold a pseudo index
value.  I use this in conjunction with an array of child forms and a "Count"
variable.  This allows me to reorder the "Tag" values of remaining open
child forms when one of the child forms is unloaded.

You can refer to the child forms in several ways:
MyForm(Me.Tag)
MyForm(Count)
MyForm(2)
If Count > 0...
For l = 1 to Count
    MyForm(l).....
next l

You can email me for a small working example.

Rob

Quote:

> I have a number of MDIChild forms that I have to cycle through. Instead
> of refering to them as MyForm1, MyForm2, etc. is there a way I can refer
> to them as MyForm(Index) or something similar?

______________________________________________________________________________
Posted Via Binaries.net = SPEED+RETENTION+COMPLETION = http://www.binaries.net


Thu, 08 Apr 2004 16:11:45 GMT  
 Is an array of forms possible?
How about:

Dim myforms(1 To 5) As Form1

Dave

Quote:
-----Original Message-----

Posted At: Saturday, October 20, 2001 5:07 AM
Posted To: misc
Conversation: Is an array of forms possible?
Subject: Is an array of forms possible?

I have a number of MDIChild forms that I have to cycle through. Instead
of refering to them as MyForm1, MyForm2, etc. is there a way I can refer
to them as MyForm(Index) or something similar?



Sat, 10 Apr 2004 00:15:49 GMT  
 Is an array of forms possible?
    Dim frm As Form

    ' for every form in our App...
    For Each frm In Forms

            ' ...as long as it isn't our parent...
            If Not TypeOf frm Is MDIForm Then

                ' ...and it *is* an MDI-Child...
                If frm.MDIChild Then
                    frm.Caption = "I'm a child manipulated at runtime!"
                End If

            End If

    Next frm

--
Dag.


Quote:
> I have a number of MDIChild forms that I have to cycle through. Instead
> of refering to them as MyForm1, MyForm2, etc. is there a way I can refer
> to them as MyForm(Index) or something similar?



Sat, 10 Apr 2004 15:57:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Array of Form Objects - Possible???

2. Help: VB3: Arrays of arrays possible?

3. Is this possible, or am I pushing it?

4. Is this possible, or am I pushing it?

5. Is this possible, or am I pushing it?

6. is this possible or am I dreaming

7. Form in a Parent Form's Frame - Is it possible

8. Special form-to-form transitions...possible?

9. Special form-to-form transitions...possible?

10. Special form-to-form transitions...possible?

11. Special form-to-form transitions...possible?

12. Creating Arrays at runtime - Is it possible?

 

 
Powered by phpBB® Forum Software