Inner class problem.

M

Mr. X.

Hello.
I have a control :
public class myClass
private class myInnerClass
...
end class

end class

How myInnerClass can access myClass ?

Need sample, please.

Thanks :)
 
P

Phill W.

Hello.
I have a control :
public class myClass
private class myInnerClass
...
end class

end class

How myInnerClass can access myClass ?

Public Class myClass

Private Class myInnerClass
Private Sub New()
End Sub

' "Friend" just in case we ever make this class Public.
' Only code in this Assembly can create these.
Friend Sub New( byval parent as myClass )
m_parent = parent
End Sub

Private m_parent as myClass = Nothing

Private ReadOnly Property Parent() as myClass
Get
Return m_parent
End Get
End Property

End Class

End Class

Code within myInnerClass should reference the parent object by
Me.Parent. ...

HTH,
Phill W.
 
A

Armin Zingler

Am 11.06.2010 11:49, schrieb Mr. X.:
Hello.
I have a control :
public class myClass
private class myInnerClass
...
end class

end class

How myInnerClass can access myClass ?

Which instance of myClass? There can be 0 to many instances.
 

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