Databinding class to dataset

Hi, although there are dozens of examples on how to bind controls to a dataset but I cannot find any examples of how to bind class properties to a dataset. ie
public class DataItem
'List of Property getters/setters
end class
public class DataItemsCollection
Inherits System.Collections.CollectionBase
Default Public ReadOnly Property Item(ByVal index As Integer) As PrintItem
Get
Return CType(List(index), PrintItem)
End Get
End Property
Public Sub Add(ByVal Value As PrintItem)
List.Add(Value)
End Sub
Public Sub Remove(ByVal PrintItem As PrintItem)
List.Remove(PrintItem)
End Sub
end class
Now how do I bind each DataItem property for the collection of DataItems to a datatable?
Regards
Kev
[845 byte] By [KiwiCoder] at [2007-12-16]
# 1
You're going to want to implement the iDataObject into your class, and create it's required functions.


Implements IDataObject

Public Overridable Function GetData(ByVal format As String, ByVal autoConvert As Boolean) As Object
End Function
Public Overridable Function GetData(ByVal format As String) As Object
End Function
Public Overridable Function GetData(ByVal format As Type) As Object
End Function
Public Overridable Function SetData(ByVal format As Type) As Object
End Function
Public Overridable Function SetData(ByVal format As String) As Object
End Function


There are alot more functions/subs you have to implement and code for though.
See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/html/8a002deb-2727-456c-8078-a9b0d5893ed4.asp for more details.
Dustin.
Dustin_H at 2007-9-9 > top of Msdn Tech,Visual Basic,Visual Basic General...