Calling a Subroutine from another Form

  • Thread starter Thread starter Dursun
  • Start date Start date
D

Dursun

I need to call a subroutine in FormA from within FormB.
Let FormA be an MDIForm and let FormB be its MDIChild
form. So, the FormB.MDIParent property will return an
object refernce to the FormA instance. At this point I
should see the Public subroutine I defined in FormA from
within FormB. It does not show-up! Am I missing someting
here? Is there any gurus out there who can give me some
pointers as to how to deal with the situation?

Thank you very much in advance.

Dursun
 
I wish it was so easy. The intellisensor (?) does not
detact the subroutine. The code is as follows

From within FormB...
Me.MDIParent.-
Here ir should show the Subroutine via intellisense. It
does not! Am I really getting a reference to the instance
of the FormA y using Me.MDIParent?

THANK YOU
 
* "Dursun said:
I need to call a subroutine in FormA from within FormB.
Let FormA be an MDIForm and let FormB be its MDIChild
form. So, the FormB.MDIParent property will return an
object refernce to the FormA instance. At this point I
should see the Public subroutine I defined in FormA from
within FormB. It does not show-up! Am I missing someting
here? Is there any gurus out there who can give me some
pointers as to how to deal with the situation?

See my reply to the other instance of your post.
 
I wish it was so easy. The intellisensor (?) does not
detact the subroutine. The code is as follows

From within FormB...
Me.MDIParent.-
Here ir should show the Subroutine via intellisense. It
does not! Am I really getting a reference to the instance
of the FormA y using Me.MDIParent?

That's because Me.MDIParent refers to an instance of a System.Windows.Form.
Not an instance of a FormA. In order to see the members of the FormA
class, you must cast the MDIParent to an instance of FormA:

CType(Me.MDIParent,FormA).subroutine

When you hit the dot (.) you should see all the members of the FormA class.
 
Back
Top