R
Raymond Lewallen
Which would be the proper way or the reason for using any of the following
or combinations of the following? These are the 3 ways I've figured I can
do what I want to do, I just don't know which would be best:
#1
' Everything is create upon instantiation. Once completed, datatable can be
obtained from the property.
Public Class A
Private dt as DataTable
Public Sub New()
Load()
End Sub
Private Sub Load()
' Do stuff to create a datatable
dt = MyCreatedDataTable
End Sub
Public ReadOnly Property YourDataTable() As DataTable
Get
Return dt
End Get
End Property
End Class
'**********************************************************************
#2
' Everything created upon instantiation. DataTable is passed in the
Complete event.
Public Class A
Private dt as DataTable
Public Event Complete(ByVal dt As DataTable)
Public Sub New()
Load()
End Sub
Private Sub Load()
' Do stuff to create a datatable
dt = MyCreatedDataTable
RaiseEvent Complete(dt)
End Sub
End Class
'**********************************************************************
#3
' Nothing created upon instantiation. Expose Load as a function to return a
datatable.
Public Class A
Private dt as DataTable
Public Sub New()
' Do nothing
End Sub
Public Function Load() As DataTable
' Do stuff to create a datatable
Return MyCreatedDataTable
End Sub
End Class
Thanks for you input,
Raymond Lewallen
or combinations of the following? These are the 3 ways I've figured I can
do what I want to do, I just don't know which would be best:
#1
' Everything is create upon instantiation. Once completed, datatable can be
obtained from the property.
Public Class A
Private dt as DataTable
Public Sub New()
Load()
End Sub
Private Sub Load()
' Do stuff to create a datatable
dt = MyCreatedDataTable
End Sub
Public ReadOnly Property YourDataTable() As DataTable
Get
Return dt
End Get
End Property
End Class
'**********************************************************************
#2
' Everything created upon instantiation. DataTable is passed in the
Complete event.
Public Class A
Private dt as DataTable
Public Event Complete(ByVal dt As DataTable)
Public Sub New()
Load()
End Sub
Private Sub Load()
' Do stuff to create a datatable
dt = MyCreatedDataTable
RaiseEvent Complete(dt)
End Sub
End Class
'**********************************************************************
#3
' Nothing created upon instantiation. Expose Load as a function to return a
datatable.
Public Class A
Private dt as DataTable
Public Sub New()
' Do nothing
End Sub
Public Function Load() As DataTable
' Do stuff to create a datatable
Return MyCreatedDataTable
End Sub
End Class
Thanks for you input,
Raymond Lewallen