Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
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...
Being smarter than you look is always better than looking smarter than you are.
Posted

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.

Being smarter than you look is always better than looking smarter than you are.
  • *Experts*
Posted

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

Posted (edited)

TypeOf

 

TypeOf worked great. Now I can't get to the toolbar button on the MDIParent form to disable it. Any ideas?

Edited by Mothra
Being smarter than you look is always better than looking smarter than you are.
  • *Experts*
Posted

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()

:)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...