<tw*@hispeed.chwrote in message
news:11**********************@v45g2000cwv.googlegr oups.com...
Follow up question,
How would you implement a Datatable as a Property of Class where the
Table would have 5 specified columns?
thanks
You can just add it as a property, and then create it and/or populate it in
your constructor. Here's an example.
Public Class Car
Private _ColorTable As DataTable
Property ColorTable() As DataTable
Get
Return _ColorTable
End Get
Set(byVal value As ColorTable)
_ColorTable = value
End Set
End Property
Public Sub New()
CreateColorTable()
End Sub
Private Sub CreateColorTable()
'This creates a new datatable. You could just as
' easily read it in from a data source.
' I wasn't sure which method you were using.
Dim ct as New DataTable()
ct.Columns.Add("Red", GetType(Integer))
ct.Columns.Add("Blue", GetType(Integer))
ct.Columns.Add("Green", GetType(Integer))
ct.Columns.Add("Hue", GetType(Integer))
ct.Columns.Add("ColorName", GetType(String))
ColorTable = ct
End Sub
End Class
Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.