📄 dataset1.vb
字号:
End Property
Public Default ReadOnly Property Item(ByVal index As Integer) As CustomerTrackingRow
Get
Return CType(Me.Rows(index),CustomerTrackingRow)
End Get
End Property
Public Event CustomerTrackingRowChanged As CustomerTrackingRowChangeEventHandler
Public Event CustomerTrackingRowChanging As CustomerTrackingRowChangeEventHandler
Public Event CustomerTrackingRowDeleted As CustomerTrackingRowChangeEventHandler
Public Event CustomerTrackingRowDeleting As CustomerTrackingRowChangeEventHandler
Public Overloads Sub AddCustomerTrackingRow(ByVal row As CustomerTrackingRow)
Me.Rows.Add(row)
End Sub
Public Overloads Function AddCustomerTrackingRow(ByVal CustID As String, ByVal FName As String, ByVal LName As String, ByVal Address As String, ByVal Phone As String, ByVal email As String) As CustomerTrackingRow
Dim rowCustomerTrackingRow As CustomerTrackingRow = CType(Me.NewRow,CustomerTrackingRow)
rowCustomerTrackingRow.ItemArray = New Object() {CustID, FName, LName, Address, Phone, email}
Me.Rows.Add(rowCustomerTrackingRow)
Return rowCustomerTrackingRow
End Function
Public Function FindByCustID(ByVal CustID As String) As CustomerTrackingRow
Return CType(Me.Rows.Find(New Object() {CustID}),CustomerTrackingRow)
End Function
Public Function GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator
Return Me.Rows.GetEnumerator
End Function
Public Overrides Function Clone() As DataTable
Dim cln As CustomerTrackingDataTable = CType(MyBase.Clone,CustomerTrackingDataTable)
cln.InitVars
Return cln
End Function
Protected Overrides Function CreateInstance() As DataTable
Return New CustomerTrackingDataTable
End Function
Friend Sub InitVars()
Me.columnCustID = Me.Columns("CustID")
Me.columnFName = Me.Columns("FName")
Me.columnLName = Me.Columns("LName")
Me.columnAddress = Me.Columns("Address")
Me.columnPhone = Me.Columns("Phone")
Me.columnemail = Me.Columns("email")
End Sub
Private Sub InitClass()
Me.columnCustID = New DataColumn("CustID", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnCustID)
Me.columnFName = New DataColumn("FName", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnFName)
Me.columnLName = New DataColumn("LName", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnLName)
Me.columnAddress = New DataColumn("Address", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnAddress)
Me.columnPhone = New DataColumn("Phone", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnPhone)
Me.columnemail = New DataColumn("email", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnemail)
Me.Constraints.Add(New UniqueConstraint("Constraint1", New DataColumn() {Me.columnCustID}, true))
Me.columnCustID.AllowDBNull = false
Me.columnCustID.Unique = true
Me.columnFName.AllowDBNull = false
Me.columnLName.AllowDBNull = false
Me.columnAddress.AllowDBNull = false
Me.columnPhone.AllowDBNull = false
Me.columnemail.AllowDBNull = false
End Sub
Public Function NewCustomerTrackingRow() As CustomerTrackingRow
Return CType(Me.NewRow,CustomerTrackingRow)
End Function
Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow
Return New CustomerTrackingRow(builder)
End Function
Protected Overrides Function GetRowType() As System.Type
Return GetType(CustomerTrackingRow)
End Function
Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowChanged(e)
If (Not (Me.CustomerTrackingRowChangedEvent) Is Nothing) Then
RaiseEvent CustomerTrackingRowChanged(Me, New CustomerTrackingRowChangeEvent(CType(e.Row,CustomerTrackingRow), e.Action))
End If
End Sub
Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowChanging(e)
If (Not (Me.CustomerTrackingRowChangingEvent) Is Nothing) Then
RaiseEvent CustomerTrackingRowChanging(Me, New CustomerTrackingRowChangeEvent(CType(e.Row,CustomerTrackingRow), e.Action))
End If
End Sub
Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowDeleted(e)
If (Not (Me.CustomerTrackingRowDeletedEvent) Is Nothing) Then
RaiseEvent CustomerTrackingRowDeleted(Me, New CustomerTrackingRowChangeEvent(CType(e.Row,CustomerTrackingRow), e.Action))
End If
End Sub
Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowDeleting(e)
If (Not (Me.CustomerTrackingRowDeletingEvent) Is Nothing) Then
RaiseEvent CustomerTrackingRowDeleting(Me, New CustomerTrackingRowChangeEvent(CType(e.Row,CustomerTrackingRow), e.Action))
End If
End Sub
Public Sub RemoveCustomerTrackingRow(ByVal row As CustomerTrackingRow)
Me.Rows.Remove(row)
End Sub
End Class
<System.Diagnostics.DebuggerStepThrough()> _
Public Class CustomerTrackingRow
Inherits DataRow
Private tableCustomerTracking As CustomerTrackingDataTable
Friend Sub New(ByVal rb As DataRowBuilder)
MyBase.New(rb)
Me.tableCustomerTracking = CType(Me.Table,CustomerTrackingDataTable)
End Sub
Public Property CustID As String
Get
Return CType(Me(Me.tableCustomerTracking.CustIDColumn),String)
End Get
Set
Me(Me.tableCustomerTracking.CustIDColumn) = value
End Set
End Property
Public Property FName As String
Get
Return CType(Me(Me.tableCustomerTracking.FNameColumn),String)
End Get
Set
Me(Me.tableCustomerTracking.FNameColumn) = value
End Set
End Property
Public Property LName As String
Get
Return CType(Me(Me.tableCustomerTracking.LNameColumn),String)
End Get
Set
Me(Me.tableCustomerTracking.LNameColumn) = value
End Set
End Property
Public Property Address As String
Get
Return CType(Me(Me.tableCustomerTracking.AddressColumn),String)
End Get
Set
Me(Me.tableCustomerTracking.AddressColumn) = value
End Set
End Property
Public Property Phone As String
Get
Return CType(Me(Me.tableCustomerTracking.PhoneColumn),String)
End Get
Set
Me(Me.tableCustomerTracking.PhoneColumn) = value
End Set
End Property
Public Property email As String
Get
Return CType(Me(Me.tableCustomerTracking.emailColumn),String)
End Get
Set
Me(Me.tableCustomerTracking.emailColumn) = value
End Set
End Property
End Class
<System.Diagnostics.DebuggerStepThrough()> _
Public Class CustomerTrackingRowChangeEvent
Inherits EventArgs
Private eventRow As CustomerTrackingRow
Private eventAction As DataRowAction
Public Sub New(ByVal row As CustomerTrackingRow, ByVal action As DataRowAction)
MyBase.New
Me.eventRow = row
Me.eventAction = action
End Sub
Public ReadOnly Property Row As CustomerTrackingRow
Get
Return Me.eventRow
End Get
End Property
Public ReadOnly Property Action As DataRowAction
Get
Return Me.eventAction
End Get
End Property
End Class
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -