Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: Imperceptus on August 17, 2004, 11:12 AM

Title: Question about MDI Childs
Post by: Imperceptus on August 17, 2004, 11:12 AM
I have a few mdi Child windows in my program, I want to send data to a routine within the childs at run time, but can not figure out how to refer to the windows.  can anyone help?
Title: Re:Question about MDI Childs
Post by: Grok on August 17, 2004, 12:24 PM
Quote from: Imperceptus on August 17, 2004, 11:12 AM
I have a few mdi Child windows in my program, I want to send data to a routine within the childs at run time, but can not figure out how to refer to the windows.  can anyone help?

Use the name of the child window and the public interface you created for the data transfer.
Title: Re:Question about MDI Childs
Post by: Imperceptus on August 17, 2004, 12:34 PM
So say I

Dim frmNewWindow as new Form1


And I do that a few times, how would I call the procedures on different ones? for say a label that needs to be changed on a paticular one during run time?
Title: Re:Question about MDI Childs
Post by: Soul Taker on August 17, 2004, 12:36 PM
Quote from: Imperceptus on August 17, 2004, 12:34 PM
So say I

Dim frmNewWindow as new Form1


And I do that a few times, how would I call the procedures on different ones? for say a label that needs to be changed on a paticular one during run time?

frmNewWindow.Label1.Caption = "Blah"
Title: Re:Question about MDI Childs
Post by: Imperceptus on August 17, 2004, 12:52 PM
As I said , It would run a few times, so there would be more then one Instance of frmNewWindow.  I have already though of storying the hwnd of the new window in an array and setting the tag of the new window to the subscript of the array to where it would correspond.  My problem is I do not know how to call procedures based of an hwnd, Or anything close to that idea.

Yes, Soul Taker, your Suggestion would work great, had I not already created a few windows with that line. and then wanted to use a procedure in the third instance.


fixed - for some reason I wrote area instead of array
Title: Re:Question about MDI Childs
Post by: Eli_1 on August 17, 2004, 01:37 PM
You should be able to do something like:


Dim frmMyForms(4) as Form
Dim i as Integer

For i = 0 to 4
   Set frmMyForms(i) = New Form1
   frmMyForms(i).Caption = "Form #" & i
   frmMyForms(i).Show
Next i

Title: Re:Question about MDI Childs
Post by: Stealth on August 17, 2004, 03:23 PM
Yes, you need to store references to them somehow. A Collection is probably best suited, depending on how dynamically you need to be able to create new windows.
Title: Re:Question about MDI Childs
Post by: Imperceptus on August 17, 2004, 03:25 PM
Quote from: Eli_1 on August 17, 2004, 01:37 PM
You should be able to do something like:


Dim frmMyForms(4) as Form
Dim i as Integer

For i = 0 to 4
   Set frmMyForms(i) = New Form1
   frmMyForms(i).Caption = "Form #" & i
   frmMyForms(i).Show
Next i

Problem solved, thanks for the suggestion.