How to send objects to MDIParent

R

Rob

Hello,
I can easily send data types from any MDI parent to an MDI Child
window using something like MDIChild( i ).ChildSubroutine( i2 ), which
would call the Public subroutine ChildSubroutine in my Child Form and
send the parameter integer i2. However I cannot figure out how to call a
Public subroutine contained in the MDIParent from the MDIChild.

Please help RS, TIA
 
C

Cor Ligthert [MVP]

Rob

Me.mdiparent.mymethod (assuming the method is friend or public)

I hope this helps,

Cor
 
C

Cor Ligthert [MVP]

Rob,

Sorry I did it to quick

DirectCast(Me.MdiParent, FormMdiParent).MyMethodInFormMdiParent()

I hope this helps,

Cor
 
C

Chris

Rob said:
Sorry, but the Me.mdiparent.mymethod () does not work. I wish it
was that easy.

Why doesn't it work? Is MdiParent set to nothing or can you not see the
method you want to work against? You may have to cast mdiparent to
whatever form type mdiparent is and then use the method.

Chris
 
R

Rob

Cor Ligthert,

This is the routine I am attempting to execute in the Parent Form:
Public Sub SetAppropriateWindow(ByVal i As Integer)

'use parameter i for something

End Sub

and the routine that is the child form is:

Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

'Call SetAppropriateWindow of MDIParent

DirectCast( Me.MdiParent, FormMdiParent ).SetAppropriateWindow(3)

t1 = New Thread(AddressOf AmibrokerThread)

t1.Start()

End Sub

that second parameter " FormMdiParent " , where can I get that parameter ?

Also, in MS Visual J if I wanted to communicate between 2 Forms I had to

go through an Interface class, does that also apply to VB.NET ?
 
C

Cor Ligthert [MVP]

Rob,


DirectCast( Me.MdiParent, FormMdiParent ).SetAppropriateWindow(3)

That FormMdiParent is in my sample a substitute for the name of the class
from the parent.

When you set there the right name it should work in my opinion.

It is not really nice OOP, however because that a mdiform is always a child
of a certain parent, would I not know what there practical can be an
objection in this case.

I hope this helps,

Cor
 

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