Home All Groups Group Topic Archive Search About

Sharing references/members

Author
14 Apr 2005 6:46 PM
Tom S.
..Net 2003 V- 7.1.3088
Framework 1.1 V- 1.1.4322 SP1
WinXp SP2

I'm building a WinForms project and I have 3 levels of
forms( the MDI Form, a MDI child form, and a modal form
called from the MDI child form ).  I have a member
declared in the MDI Form that I need to be able to
manipulate from within the other two forms and I'm not
sure of the best way to go about this ( I'm used to
ASP.net, where I would simply put this in the Session
object and call it from each page ).  Can anyone point me
in the right direction here?  Thanks!!!

Tom S.

Author
15 Apr 2005 3:56 AM
Adam Goossens
Tom,

Create a new property for your MDI form that exposes the object you require.

Then, from the child form:

----
Me.MdiParent.YourProperty.SomeMethod()
----

For the modal form to access the property you need to pass a reference
to the MDI parent somehow. I personally suggest passing the reference as
an argument to the modal form's constructor.

Regards,
-Adam.

Tom S. wrote:
Show quoteHide quote
> .Net 2003 V- 7.1.3088
> Framework 1.1 V- 1.1.4322 SP1
> WinXp SP2
>
> I'm building a WinForms project and I have 3 levels of
> forms( the MDI Form, a MDI child form, and a modal form
> called from the MDI child form ).  I have a member
> declared in the MDI Form that I need to be able to
> manipulate from within the other two forms and I'm not
> sure of the best way to go about this ( I'm used to
> ASP.net, where I would simply put this in the Session
> object and call it from each page ).  Can anyone point me
> in the right direction here?  Thanks!!!
>
> Tom S.
Author
15 Apr 2005 3:42 PM
anonymous
That works perfectly, Thanks!!!!!


>-----Original Message-----
>Tom,
>
>Create a new property for your MDI form that exposes the
object you require.
>
>Then, from the child form:
>
>----
>Me.MdiParent.YourProperty.SomeMethod()
>----
>
>For the modal form to access the property you need to
pass a reference
>to the MDI parent somehow. I personally suggest passing
the reference as
Show quoteHide quote
>an argument to the modal form's constructor.
>
>Regards,
>-Adam.
>
>Tom S. wrote:
>> .Net 2003 V- 7.1.3088
>> Framework 1.1 V- 1.1.4322 SP1
>> WinXp SP2
>>
>> I'm building a WinForms project and I have 3 levels of
>> forms( the MDI Form, a MDI child form, and a modal form
>> called from the MDI child form ).  I have a member
>> declared in the MDI Form that I need to be able to
>> manipulate from within the other two forms and I'm not
>> sure of the best way to go about this ( I'm used to
>> ASP.net, where I would simply put this in the Session
>> object and call it from each page ).  Can anyone point
me
>> in the right direction here?  Thanks!!!
>>
>> Tom S.
>.
>