
Why Isn't MyBase.New() Working Here?
Why Isn't MyBase.New() Working Here?
Hello Everyone.
Please help.
I have some code, excerpted below, that contains a default constructor and
a parameterized constructor.
I am trying to "do the right thing" and call MyBase.New() in the
parameterized constructor, which, at least in this is, is exactly what I
want to do.
However, if I set a breakpoint on the declaration of the parameterized
constructor and then step through the code from the there line by line, I
notice that control flow does not jump to the default constructor when then
MyBase.New() line executes.
Why?
(The side-effect of this is that a class member object never gets
initialized and I NEED to make sure that it get initialized.)
What am I missing?
Please advise.
Thank you.
--Mark.
#Region " Class Members "
'This class member must exist at all times.
Private m_objUtility As Worker
Private m_objInvoiceSummary As InvoiceSummary
#End Region
#Region " Properties "
Public ReadOnly Property Utility() As Worker
Get
Return m_objUtility
End Get
End Property
Public ReadOnly Property InvoiceSummary() As InvoiceSummary
Get
Return m_objInvoiceSummary
End Get
End Property
#End Region
#Region " Constructors "
'This method is the default constructor.
Public Sub New()
m_objUtility = New Worker()
End Sub
'The method is a parameterized constructor.
Public Sub New(ByRef thisInvoiceSummary As InvoiceSummary)
''''THIS CALL SHOULD RUN
''''THE DEFAULT CONSTRUCTOR
''''AND INITIALIZE THE CLASS
''''MEMBER OBJECT.
MyBase.New()
m_objInvoiceSummary = thisInvoiceSummary
CreateInvoiceSummaryTable(thisInvoiceSummary)
End Sub