Access to MdiParent Controls in VB.Net

G

Guest

Good Day, I have a programming problem and need some help/advice. I have a
MdiParent Form that has a tool bar with icons on it. I have a child form that
needs set the toolbar enabled property to FALSE. Currently, I have the
following syntax in my main module when running the application:

Public Sub Main()

Dim frmSplash As SplashScreen
Dim frmParent As ParentForm

'Directory structure to fox table.
vfClass.mydirectory = Directory.GetCurrentDirectory & _
"\data\sysconn.dbf"

Try

(Code)....

System.Windows.Forms.Application.EnableVisualStyles()
System.Windows.Forms.Application.DoEvents()
System.Windows.Forms.Application.Run(New SplashScreen)
System.Windows.Forms.Application.Run(New ParentForm)
End Module

As you can see the form is not a global form. In my child form I need to
disable the menu and toolbar on the ParentForm when the child form is loaded.
How can I access the menu/toolbar on the ParentForm? Any ideas?Thanks.
 
C

Cor Ligthert

Terrance,

You show us some code, however how I don't see any relation with your
problem. Normaly can you access a mdiparent just by telling that it is the
mdiparent in the child.
Something as
Mdiparent.whatever

I hope this helps something,

Cor
 
C

Charles Law

Hi Terrance

This came up recently in the WindowsForms group, but my answer here is the
same:

<snip>
The common way to implement this is for your child form to raise an event
when its state changes, so that the owner - in this case the parent form -
can update its menus and toolbar buttons. The event passes two parameters,
the second of which is a class derived from EventArgs. This new class
contains enough information for the owner to determine which menus should be
active. If you want to look this up it is called the Observer pattern.
</snip>

HTH

Charles
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top