Последовательность действий по созданию проекта

Создать приложение Silverlight

К проекту.exe присоединить два модуля класов

В первом модуле создать класс – экземпляр записи и класс – класс коллекцию, объединяющую все экземпляры, как в приведенном ниже примере

Public Class Customer

Public Sub New()

End Sub

Public Sub New(ByVal customerId As String,

ByVal companyName As String,

ByVal city As String)

customerIDValue = customerId

companyNameValue = companyName

cityValue = city

End Sub

Private customerIDValue As String

Public Property CustomerID() As String

Get

Return customerIDValue

End Get

Set(ByVal value As String)

customerIDValue = value

End Set

End Property

Private companyNameValue As String

Public Property CompanyName() As String

Get

Return companyNameValue

End Get

Set(ByVal Value As String)

companyNameValue = Value

End Set

End Property

Private cityValue As String

Public Property City() As String

Get

Return cityValue

End Get

Set(ByVal Value As String)

cityValue = Value

End Set

End Property

Private ordersValue As Orders

Public Property Orders As Orders

Get

Return ordersValue

End Get

Set(ByVal value As Orders)

ordersValue = value

End Set

End Property

Public Overrides Function ToString() As String

Return Me.CompanyName & " (" & Me.CustomerID & ")"

End Function

End Class

Public Class Customers

Inherits System.Collections.Generic.List(Of Customer)

End Class

Последний класс – коллекция должен быть типизирован для заданных объектов и наследует. System.Collections.Generic.List(Of Customer).

Для записей подчиненной таблицы создать аналогичные классы.

Public Class Order

Public Sub New()

End Sub

Public Sub New(ByVal orderid As Integer,

ByVal customerID As String)

orderIDValue = orderid

customerIDValue = customerID

End Sub

Private orderIDValue As Integer

Public Property OrderID() As Integer

Get

Return orderIDValue

End Get

Set(ByVal value As Integer)

orderIDValue = value

End Set

End Property

Private customerIDValue As String

Public Property CustomerID() As String

Get

Return customerIDValue

End Get

Set(ByVal Value As String)

customerIDValue = Value

End Set

End Property

End Class

Public Class Orders

Inherits System.Collections.Generic.List(Of Order)

End Class


Понравилась статья? Добавь ее в закладку (CTRL+D) и не забудь поделиться с друзьями:  



double arrow
Сейчас читают про: