Define a private Structure within a class
Posted on 2004-08-24
My goal is to be able to create a private structure within a class. What I have done so far is:
Private Structure SESSION_STATUS
Private chShortSessionName As Char
Private strLongSessionName As String
Private chSessionType As Char
Private bSessionCharacteristics As Byte
Private iNumRows As Int16
Private iNumCols As Int16
Private iHostCodePageNum As Int16
Private MySession as SESSION_STATUS
MySession.chSessionType = "X"
C:\john\VBScreenScrape1\HostSession.vb(396): 'VBScreenScrape1.MySession.SESSION_STATUS.chSessionType' is not accessible in this context because it is 'Private'.
my problem is - when I attempt to access the data items (example MySession.chSessionType) from within the class, I get a compile error telling me the data item is private. I've attempted to change the protection of the structure members to protected - but that is not allowed. My bet is if I change to public it will work - but I don't want any of that detail to be visible outside the class.
If my structure is private but data members public - will the data members be visible outside the class?
Is this the best way to achieve the behaviour I am after - ability to manipulate within the class - but invisible outside the class? If not, what is?