📄 ds2accessory.vb
字号:
Public Overrides Function Clone() As DataTable
Dim cln As accessoryDataTable = CType(MyBase.Clone,accessoryDataTable)
cln.InitVars
Return cln
End Function
Protected Overrides Function CreateInstance() As DataTable
Return New accessoryDataTable
End Function
Friend Sub InitVars()
Me.columnano = Me.Columns("ano")
Me.columndescript = Me.Columns("descript")
Me.columnprice = Me.Columns("price")
Me.columnstand = Me.Columns("stand")
Me.columnaname = Me.Columns("aname")
Me.columnanount = Me.Columns("anount")
End Sub
Private Sub InitClass()
Me.columnano = New DataColumn("ano", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnano)
Me.columndescript = New DataColumn("descript", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columndescript)
Me.columnprice = New DataColumn("price", GetType(System.Decimal), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnprice)
Me.columnstand = New DataColumn("stand", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnstand)
Me.columnaname = New DataColumn("aname", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnaname)
Me.columnanount = New DataColumn("anount", GetType(System.Int32), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnanount)
End Sub
Public Function NewaccessoryRow() As accessoryRow
Return CType(Me.NewRow,accessoryRow)
End Function
Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow
Return New accessoryRow(builder)
End Function
Protected Overrides Function GetRowType() As System.Type
Return GetType(accessoryRow)
End Function
Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowChanged(e)
If (Not (Me.accessoryRowChangedEvent) Is Nothing) Then
RaiseEvent accessoryRowChanged(Me, New accessoryRowChangeEvent(CType(e.Row,accessoryRow), e.Action))
End If
End Sub
Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowChanging(e)
If (Not (Me.accessoryRowChangingEvent) Is Nothing) Then
RaiseEvent accessoryRowChanging(Me, New accessoryRowChangeEvent(CType(e.Row,accessoryRow), e.Action))
End If
End Sub
Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowDeleted(e)
If (Not (Me.accessoryRowDeletedEvent) Is Nothing) Then
RaiseEvent accessoryRowDeleted(Me, New accessoryRowChangeEvent(CType(e.Row,accessoryRow), e.Action))
End If
End Sub
Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowDeleting(e)
If (Not (Me.accessoryRowDeletingEvent) Is Nothing) Then
RaiseEvent accessoryRowDeleting(Me, New accessoryRowChangeEvent(CType(e.Row,accessoryRow), e.Action))
End If
End Sub
Public Sub RemoveaccessoryRow(ByVal row As accessoryRow)
Me.Rows.Remove(row)
End Sub
End Class
<System.Diagnostics.DebuggerStepThrough()> _
Public Class accessoryRow
Inherits DataRow
Private tableaccessory As accessoryDataTable
Friend Sub New(ByVal rb As DataRowBuilder)
MyBase.New(rb)
Me.tableaccessory = CType(Me.Table,accessoryDataTable)
End Sub
Public Property ano As String
Get
Try
Return CType(Me(Me.tableaccessory.anoColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tableaccessory.anoColumn) = value
End Set
End Property
Public Property descript As String
Get
Try
Return CType(Me(Me.tableaccessory.descriptColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tableaccessory.descriptColumn) = value
End Set
End Property
Public Property price As Decimal
Get
Try
Return CType(Me(Me.tableaccessory.priceColumn),Decimal)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tableaccessory.priceColumn) = value
End Set
End Property
Public Property stand As String
Get
Try
Return CType(Me(Me.tableaccessory.standColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tableaccessory.standColumn) = value
End Set
End Property
Public Property aname As String
Get
Try
Return CType(Me(Me.tableaccessory.anameColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tableaccessory.anameColumn) = value
End Set
End Property
Public Property anount As Integer
Get
Try
Return CType(Me(Me.tableaccessory.anountColumn),Integer)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tableaccessory.anountColumn) = value
End Set
End Property
Public Function IsanoNull() As Boolean
Return Me.IsNull(Me.tableaccessory.anoColumn)
End Function
Public Sub SetanoNull()
Me(Me.tableaccessory.anoColumn) = System.Convert.DBNull
End Sub
Public Function IsdescriptNull() As Boolean
Return Me.IsNull(Me.tableaccessory.descriptColumn)
End Function
Public Sub SetdescriptNull()
Me(Me.tableaccessory.descriptColumn) = System.Convert.DBNull
End Sub
Public Function IspriceNull() As Boolean
Return Me.IsNull(Me.tableaccessory.priceColumn)
End Function
Public Sub SetpriceNull()
Me(Me.tableaccessory.priceColumn) = System.Convert.DBNull
End Sub
Public Function IsstandNull() As Boolean
Return Me.IsNull(Me.tableaccessory.standColumn)
End Function
Public Sub SetstandNull()
Me(Me.tableaccessory.standColumn) = System.Convert.DBNull
End Sub
Public Function IsanameNull() As Boolean
Return Me.IsNull(Me.tableaccessory.anameColumn)
End Function
Public Sub SetanameNull()
Me(Me.tableaccessory.anameColumn) = System.Convert.DBNull
End Sub
Public Function IsanountNull() As Boolean
Return Me.IsNull(Me.tableaccessory.anountColumn)
End Function
Public Sub SetanountNull()
Me(Me.tableaccessory.anountColumn) = System.Convert.DBNull
End Sub
End Class
<System.Diagnostics.DebuggerStepThrough()> _
Public Class accessoryRowChangeEvent
Inherits EventArgs
Private eventRow As accessoryRow
Private eventAction As DataRowAction
Public Sub New(ByVal row As accessoryRow, ByVal action As DataRowAction)
MyBase.New
Me.eventRow = row
Me.eventAction = action
End Sub
Public ReadOnly Property Row As accessoryRow
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 + -