I am trying to create a class in Visual Basic 2005 environment to hold
all information closely together. There are two variables I want to use,
and they look like this:
*************** *************** *************** *************** **********
clsLayerZ1
|
+-Headers
| |
| +-Header1 = Text1 (String)
| +-Header2 = Text2 (String)
| +-....
+-LC(0)
| |
| +-ID = LC ID (Integer)
| +-Entity(0)
| | |
| | +-ID = Entity ID (Integer)
| | +-Loads
| | |
| | +-Load1 = Value1 (Double)
| | +-Load2 = Value2 (Double)
| | +-Load3 = Value3 (Double)
| | +-....
| +-Entity(1)
| | |
| | +-ID = Entity ID (Integer)
| | +-Loads
| | |
| | +-Load1 = Value1 (Double)
| | +-....
| +-....
+-LC(1)
| |
| +-ID = LC ID (Integer)
| +-....
+-....
*************** *************** *************** *************** **********
I currently have tried to do it this way:
*************** *************** *************** *************** **********
Public Class Layer
Private _iLCs As Integer
Private _iHeaders As Short
Private _iEntities As Long
Sub New(ByVal iLCs As Integer, ByVal iEntities As Long, ByVal
iHeaders As Short)
_iLCs = iLCs
_iEntities = iEntities
_iHeaders = iHeaders
ReDim _LoadCase(_iEnt ities)
End Sub
Public LoadCase(_iLCs) As LoadCase(_iEnti ties)
Public Headers(_iHeade rs) As String
End Class
Public Class LoadCase
Private _iEntities As Long
Sub New(ByVal iEntities As Long)
_iEntities = iEntities
End Sub
Public LCID As Long
Public Entities(_iEnti ties) As Entity(iLoadCom ponents)
End Class
Public Class Entity
Private _iLoadComponent s As Short
Sub New(ByVal iLoadComponents As Short)
_iLoadComponent s = iLoadComponents
End Sub
Public EntityID As Long
Public LoadsInfo(_iLoa dComponents) As Double
End Class
*************** *************** *************** *************** **********
Unfortunately, this method is not working for me. I probably have some
fundamental flaws in the code I'm trying to use, but I haven't got any
idea how to do this properly.
Another problem that I have: these variables are to be used in multiple
procedures, but one of these procedures generates the required
dimensions for the various sub-arrays in the class I want to create.
Hopefully someone is able to help me by perhaps providing me with a
decent example of how this is done.
Regards, CoRrRan
all information closely together. There are two variables I want to use,
and they look like this:
*************** *************** *************** *************** **********
clsLayerZ1
|
+-Headers
| |
| +-Header1 = Text1 (String)
| +-Header2 = Text2 (String)
| +-....
+-LC(0)
| |
| +-ID = LC ID (Integer)
| +-Entity(0)
| | |
| | +-ID = Entity ID (Integer)
| | +-Loads
| | |
| | +-Load1 = Value1 (Double)
| | +-Load2 = Value2 (Double)
| | +-Load3 = Value3 (Double)
| | +-....
| +-Entity(1)
| | |
| | +-ID = Entity ID (Integer)
| | +-Loads
| | |
| | +-Load1 = Value1 (Double)
| | +-....
| +-....
+-LC(1)
| |
| +-ID = LC ID (Integer)
| +-....
+-....
*************** *************** *************** *************** **********
I currently have tried to do it this way:
*************** *************** *************** *************** **********
Public Class Layer
Private _iLCs As Integer
Private _iHeaders As Short
Private _iEntities As Long
Sub New(ByVal iLCs As Integer, ByVal iEntities As Long, ByVal
iHeaders As Short)
_iLCs = iLCs
_iEntities = iEntities
_iHeaders = iHeaders
ReDim _LoadCase(_iEnt ities)
End Sub
Public LoadCase(_iLCs) As LoadCase(_iEnti ties)
Public Headers(_iHeade rs) As String
End Class
Public Class LoadCase
Private _iEntities As Long
Sub New(ByVal iEntities As Long)
_iEntities = iEntities
End Sub
Public LCID As Long
Public Entities(_iEnti ties) As Entity(iLoadCom ponents)
End Class
Public Class Entity
Private _iLoadComponent s As Short
Sub New(ByVal iLoadComponents As Short)
_iLoadComponent s = iLoadComponents
End Sub
Public EntityID As Long
Public LoadsInfo(_iLoa dComponents) As Double
End Class
*************** *************** *************** *************** **********
Unfortunately, this method is not working for me. I probably have some
fundamental flaws in the code I'm trying to use, but I haven't got any
idea how to do this properly.
Another problem that I have: these variables are to be used in multiple
procedures, but one of these procedures generates the required
dimensions for the various sub-arrays in the class I want to create.
Hopefully someone is able to help me by perhaps providing me with a
decent example of how this is done.
Regards, CoRrRan
Comment