Mothra Posted September 3, 2003 Posted September 3, 2003 Is there a way for an MDI Child form (well call it Form1...) to poll the parent and see if there are any other child forms (instances of Form1...) open? I am trying to disable a toolbar button if there are no other "like" child forms open... Quote Being smarter than you look is always better than looking smarter than you are.
*Experts* mutant Posted September 3, 2003 *Experts* Posted September 3, 2003 An MDI Parent form has an MDIChildren property, you could searh that. Quote
Mothra Posted September 4, 2003 Author Posted September 4, 2003 Child forms Yes but, I need to determine what form the remaining child/children forms are (e.g. Form2, Form3, or whatever...). What I want to happen is to disable a toolbar button and a menu command if there are no more of a certain form. I just can't seem to tell what is what in the .MDIChildren property. Quote Being smarter than you look is always better than looking smarter than you are.
*Experts* mutant Posted September 4, 2003 *Experts* Posted September 4, 2003 If you want to see if a certain type of a form is opened then you could do this: Dim f As Form For Each f In Me.MdiChildren If TypeOf f Is Form3 Then 'do something if a form is of the Form3 type End If Next Quote
Mothra Posted September 5, 2003 Author Posted September 5, 2003 (edited) TypeOf TypeOf worked great. Now I can't get to the toolbar button on the MDIParent form to disable it. Any ideas? Edited September 5, 2003 by Mothra Quote Being smarter than you look is always better than looking smarter than you are.
*Experts* mutant Posted September 5, 2003 *Experts* Posted September 5, 2003 Cast the MDIParent object of your mdi child to a type of the parent and then access the toolbar: DirectCast(Me.MdiParent, ParentType).Toolbar1.something() :) Quote
Mothra Posted September 5, 2003 Author Posted September 5, 2003 That was it. I can not thank you enough! Quote Being smarter than you look is always better than looking smarter than you are.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.