Help instantiating Object which contains 2 embedded objects

I am having some real issues with this one. I have a class which contains two other objects...but I cannot seem to instantiate those sub objects. Here is the code for my class:
Option Explicit On
Public Class Boot
'A collection of Heads and Shells
#Region "Private Variables"
Private _oHead As New WQS_BusinessEntity.Head
Private _oShell As New WQS_BusinessEntity.Shell
Private _iBootID As Integer
Private _iBootTypeID As Integer
Private _iVesselID As Integer

#End Region

#Region "Constructors"
Public Sub New()

End Sub
Public Sub New(ByVal iBootID As Integer, ByVal iBootTypeID As Integer, ByVal iVesselID As Integer)
_oHead = New WQS_BusinessEntity.Head
_oShell = New WQS_BusinessEntity.Shell
_iBootID = iBootID
_iBootTypeID = iBootTypeID
_iVesselID = iVesselID

End Sub
#End Region

#Region "Public Properties"
Public Property oHead() As Head
Return _oHead
End Get
Set(ByVal oValue As Head)
_oHead = oValue
End Set
End Property

Public Property oShell() As Shell
Return _oShell
End Get
Set(ByVal oValue As Shell)
_oShell = oValue
End Set
End Property

Public Property iBootID() As Integer
Return _iBootID
End Get
Set(ByVal iValue As Integer)
_iBootID = iValue
End Set
End Property
Public Property iBootTypeID() As Integer
Return _iBootTypeID
End Get
Set(ByVal iValue As Integer)
_iBootTypeID = iValue
End Set
End Property
Public Property iVesselID() As Integer
Return _iVesselID
End Get
Set(ByVal iValue As Integer)
_iVesselID = iValue
End Set
End Property
#End Region
End Class

Public Class BootSet
Inherits Collections.ArrayList

Public Shadows Function Add(ByVal oValue As Boot) As Integer
If Not oValue Is Nothing Then

End If
End Function

Default Public Shadows Property Item(ByVal iIndex As Integer) As Boot
Return CType(MyBase.Item(iIndex), Boot)

End Get
Set(ByVal Value As Boot)
MyBase.Item(iIndex) = Value
End Set
End Property

End Class

When I am using my Boot Object, I do so Here in my DAL:


Dim oRow As DataRow
Dim oSet As New WQS_BusinessEntity.BootSet
Dim iCount As Integer = 0
'Dim iTable As Integer
'iTable = oDS.Tables.Count - 1
For Each oRow In oDS.Tables(1).Rows
Dim oItem As New WQS_BusinessEntity.Boot

With oItem

'Boot Data
.iBootID = oDS.Tables(0).Rows(iCount).Item("BootID")
.iBootTypeID = oDS.Tables(1).Rows(iCount).Item("BootFunctionTypeId")
.iVesselID = oDS.Tables(1).Rows(iCount).Item("VesselId")
'1 head, 1 shell per boot now.

'Head Data
oItem.oHead.iHeadID = ZeroIfNull(oDS.Tables(1).Rows(iCount).Item("HeadId"))
oItem.oHead.iVesselID = ZeroIfNull(oDS.Tables(1).Rows(iCount).Item("VesselId"))
oItem.oHead.iMaterialID = ZeroIfNull(oDS.Tables(1).Rows(iCount).Item("HeadMaterialId"))
oItem.oHead.iLocationID = ZeroIfNull(oDS.Tables(1).Rows(iCount).Item("HeadLocationId"))
oItem.oHead.strMaterial = oDS.Tables(1).Rows(iCount).Item("HeadMaterialName")
oItem.oHead.dDiameter = ZeroIfNull(oDS.Tables(1).Rows(iCount).Item("HeadDiameter"))
oItem.oHead.dCurrentThickness = ZeroIfNull(oDS.Tables(1).Rows(iCount).Item("HeadCurrentThickness"))
oItem.oHead.dNominalThickness = ZeroIfNull(oDS.Tables(1).Rows(iCount).Item("HeadNominalThickness"))
oItem.oHead.strShape = oDS.Tables(1).Rows(iCount).Item("HeadShapeName")
oItem.oHead.iShapeID = ZeroIfNull(oDS.Tables(1).Rows(iCount).Item("HeadShapeId"))
oItem.oHead.strLocation = EmptyIfNull(oDS.Tables(1).Rows(iCount).Item("HeadLocationOnVesselName"))
oItem.oShell.iShellID = ZeroIfNull(oDS.Tables(1).Rows(iCount).Item("ShellId"))
oItem.oShell.iVesselID = ZeroIfNull(oDS.Tables(1).Rows(iCount).Item("VesselId"))
oItem.oShell.iMaterialID = ZeroIfNull(oDS.Tables(1).Rows(iCount).Item("ShellMaterialId"))
oItem.oShell.strMaterial = EmptyIfNull(oDS.Tables(1).Rows(iCount).Item("ShellMaterialName"))
oItem.oShell.dDiameter = ZeroIfNull(oDS.Tables(1).Rows(iCount).Item("ShellDiameter"))
oItem.oShell.dCurrentThickness = ZeroIfNull(oDS.Tables(1).Rows(iCount).Item("ShellCurrentThickness"))
oItem.oShell.dNominalThickness = ZeroIfNull(oDS.Tables(1).Rows(iCount).Item("ShellNominalThickness"))
Select Case oDS.Tables(1).Rows(iCount).Item("ShellOrientation")
Case 0.0
oItem.oShell.cOrientation = "H"
Case 90.0
oItem.oShell.cOrientation = "V"
Case Else
'default to horizontal
oItem.oShell.cOrientation = "H"
End Select

End With
'Add the Boot to the BootSet
iCount = iCount + 1


Return oSet
End Function

However, when I place a breakpoint on the 'Return oSET' line, and add a watch, this is what I see:

- oSet Count = 5 WQS_BusinessEntity.BootSet
- (0) {WQS_BusinessEntity.Boot} Object
- WQS_BusinessEntity.Boot {WQS_BusinessEntity.Boot} WQS_BusinessEntity.Boot
_iBootID 220 Integer
_iBootTypeID 0 Integer
_iVesselID 30 Integer
+ _oHead Count = 0 WQS_BusinessEntity.Head
+ _oShell Count = 0 WQS_BusinessEntity.Shell
iBootID 220 Integer
iBootTypeID 0 Integer
iVesselID 30 Integer
+ oHead Count = 0 WQS_BusinessEntity.Head
+ oShell Count = 0 WQS_BusinessEntity.Shell
+ (1) {WQS_BusinessEntity.Boot} Object
+ (2) {WQS_BusinessEntity.Boot} Object
+ (3) {WQS_BusinessEntity.Boot} Object
+ (4) {WQS_BusinessEntity.Boot} Object

Notice the count for my two objects, Ohead, and oShell, is zero. Im not sure why this doesnt instantiate properly, as I believe is what is going on. I could really use some help!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!