vb.net access public method in nested classes from another class

P

Pj

hi,

i am new to vb.net and i am stuck at a particular point in my project.

i have two nested classes (because vb.net does NOT allow multiple
inheritance)

-----------------------------------------
Class DrawingCanvas
Inherit System.Windows.Forms.Form

Class OurView
Inherit CsGL.OpenGL.OpenGLControl

Sub A
Sub B
Sub C

End Class
End Class
-----------------------------------------

Then i have another class somewhere else

-----------------------------------------
Class Controls
Inherit System.Windows.Forms.Form

Sub Z

End Class
-----------------------------------------

Now from class Controls i am trying to access Sub A (from class
OurView) but can not access it. How is this possible in vb.net?

thanks
pj
 
A

Adam Goossens

Hi PJ,

As long as you create an instance of DrawingCanvas.OurView first (you
will have to fully qualify the name), you should be able to access Sub A
with no problems:

----
Class Controls
Inherits System.Windows.Forms.Form

Sub Z()
Dim ov as New DrawingCanvas.OurView()
ov.A()
End Sub
----

If I'm incorrect in my assumptions, please provide more detail as to the
error you are experiencing.

Regards,
-Adam.
 

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