21.3. Object Data Source

In a number of projects, an application is broken up into multiple tiers. Quite often it is not possible to pass around strongly typed DataSets, because they may be quite large, or perhaps the project requires custom business objects. In either case, it is possible to take the DataBinding techniques you just learned for DataSets and apply them to objects. For the purposes of this discussion, use the following Customer and SalesOrder classes:

Public Class Customer
    Private m_Name As String
    Public Property Name() As String
        Get
            Return m_Name
        End Get
        Set(ByVal value As String)
            m_Name = value
        End Set
    End Property

    Private m_Orders As New List(Of SalesOrder)
    Public Property Orders() As List(Of SalesOrder)
        Get
            Return m_Orders
        End Get
        Set(ByVal value As List(Of SalesOrder))
            m_Orders = value
        End Set
    End Property
End Class
Public Class SalesOrder Implements System.ComponentModel.IDataErrorInfo Private m_Description As String Public Property Description() As String Get Return m_Description End Get Set(ByVal value As String) m_Description = value End Set End Property Private m_Quantity As Integer Public Property Quantity() As Integer Get Return m_Quantity End Get Set(ByVal value As Integer) m_Quantity = value End Set End Property Private m_DateOrdered As Date Public Property DateOrdered() As Date Get Return m_DateOrdered End Get Set(ByVal value As Date) m_DateOrdered = value End Set End Property Public ReadOnly Property ErrorSummary() As String _ Implements System.ComponentModel.IDataErrorInfo.Error ...

Get Professional Visual Studio® 2008 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.