Modifying object in MDI Parent form from MDI Child form 
Author Message
 Modifying object in MDI Parent form from MDI Child form

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



Mon, 07 Feb 2005 22:57:28 GMT  
 Modifying object in MDI Parent form from MDI Child form
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

Quote:
>-----Original Message-----
>I have a status bar that is attached to an MDI Parent

that I need to update
Quote:
>from a child form.  I have tried several thing and can

not get it to work, I
Quote:
>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

>.



Tue, 08 Feb 2005 00:10:19 GMT  
 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

> >.



Tue, 08 Feb 2005 01:56:33 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Accessing Objects on a Mdi Parent form from a Mdi Child form

2. Q: Form activate Fires On Non Child MDI Forms But Only Once On Child Mdi Forms

3. Maximized MDI child form Covering Status bar on MDI parent

4. set the MDI parent of MDI child forms that are in a DLL

5. Help: Change a MDI child's parent MDI form at run-time

6. Loading MDI Child forms to a parent form from a DLL

7. Making a child form much bigger than the parent MDI form

8. Show a form - not as child - outside a MDI-parent form

9. Make a reference to a MDI form with a reference of a MDI child form

10. MDI-Child form and positon on MDI-form

11. Developing OLE MDI Child forms displayed on Control MDI Form

12. MDI child forms on top of a picture on a MDI form

 

 
Powered by phpBB® Forum Software