
Modifying object in MDI Parent form from MDI Child form
http://www.avenuezx.com/vbnet4apps/tips/3.htm
Is a good example of what I was looking for....
To modify the code for Parent-Child relations:
Put code for Form 1 in the Parent form (frmParent )
Private Shared m_frmParent As frmParent
Public Shared Property frmMain() As frmParent
Get
Return m_frmParent
End Get
Set(ByVal Value As frmParent )
m_frmParent = Value
End Set
End Property
Then in the Parent Form Load Event, place:
frmMain = Me
Then in the Child Form place in any event:
frmParent.frmMain.textbox1.text = "It Worked"
This seems like a very easy way to change controls in a parent form...from
any child....Any child can just use
frmParent.frmMain.control.property = value syntax
and it works....
Clint
Quote:
> Clint,
> The problem (without seen the full code) is probably an
> issue of instantiation vs. definition. You have to have
> the instantiation of the parent form in the child form.
> One way, rather poor tough, is to define a module with the
> instantiated parent name so the child can access it.
> HTH
> Pat
> >-----Original Message-----
> >I have a status bar that is attached to an MDI Parent
> that I need to update
> >from a child form. I have tried several thing and can
> not get it to work, I
> >have tried setting to PUBLIC, I have tried creating a sub
> in the Parent that
> >is public, but it keeps giving me:
> >Reference to a non-shared member requires an object
> reference.
> >Here is my situation:
> >MDI Parent Form Name: frmMain
> >Status Bar update Public Sub name: update_StatusBar()
> >In Child form I try
> >Call frmMain.update_StatusBar() and I get the above
> error.
> >Any advice here would greatly help me out.
> >Thanks
> >Clint
> >.