Valhalla Legends Forums Archive | Visual Basic Programming | Question about MDI Childs

AuthorMessageTime
Imperceptus
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?
August 17, 2004, 4:12 PM
Grok
[quote author=Imperceptus link=board=31;threadid=8205;start=0#msg75956 date=1092759147]
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?
[/quote]

Use the name of the child window and the public interface you created for the data transfer.
August 17, 2004, 5:24 PM
Imperceptus
So say I
[code]
Dim frmNewWindow as new Form1
[/code]

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?
August 17, 2004, 5:34 PM
Soul Taker
[quote author=Imperceptus link=board=31;threadid=8205;start=0#msg75977 date=1092764086]
So say I
[code]
Dim frmNewWindow as new Form1
[/code]

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?
[/quote]
[code]
frmNewWindow.Label1.Caption = "Blah"[/code]
August 17, 2004, 5:36 PM
Imperceptus
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
August 17, 2004, 5:52 PM
Eli_1
You should be able to do something like:

[code]
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
[/code]
August 17, 2004, 6:37 PM
Stealth
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.
August 17, 2004, 8:23 PM
Imperceptus
[quote author=Eli_1 link=board=31;threadid=8205;start=0#msg75988 date=1092767871]
You should be able to do something like:

[code]
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
[/code]
[/quote]
Problem solved, thanks for the suggestion.
August 17, 2004, 8:25 PM

Search