📄 addressdataset.vb
字号:
Me.Columns.Add(Me.columnemail)
Me.columnfax = New DataColumn("fax", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnfax)
Me.columnfirstname = New DataColumn("firstname", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnfirstname)
Me.columnidnumber = New DataColumn("idnumber", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnidnumber)
Me.columnlastname = New DataColumn("lastname", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnlastname)
Me.columnpc = New DataColumn("pc", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnpc)
Me.columnphone = New DataColumn("phone", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnphone)
Me.columnstate = New DataColumn("state", GetType(System.String), Nothing, System.Data.MappingType.Element)
Me.Columns.Add(Me.columnstate)
Me.Constraints.Add(New UniqueConstraint("Constraint1", New DataColumn() {Me.columnidnumber}, true))
Me.columnidnumber.AllowDBNull = false
Me.columnidnumber.Unique = true
End Sub
Public Function NewaddressbookRow() As addressbookRow
Return CType(Me.NewRow,addressbookRow)
End Function
Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow
Return New addressbookRow(builder)
End Function
Protected Overrides Function GetRowType() As System.Type
Return GetType(addressbookRow)
End Function
Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowChanged(e)
If (Not (Me.addressbookRowChangedEvent) Is Nothing) Then
RaiseEvent addressbookRowChanged(Me, New addressbookRowChangeEvent(CType(e.Row,addressbookRow), e.Action))
End If
End Sub
Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowChanging(e)
If (Not (Me.addressbookRowChangingEvent) Is Nothing) Then
RaiseEvent addressbookRowChanging(Me, New addressbookRowChangeEvent(CType(e.Row,addressbookRow), e.Action))
End If
End Sub
Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowDeleted(e)
If (Not (Me.addressbookRowDeletedEvent) Is Nothing) Then
RaiseEvent addressbookRowDeleted(Me, New addressbookRowChangeEvent(CType(e.Row,addressbookRow), e.Action))
End If
End Sub
Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowDeleting(e)
If (Not (Me.addressbookRowDeletingEvent) Is Nothing) Then
RaiseEvent addressbookRowDeleting(Me, New addressbookRowChangeEvent(CType(e.Row,addressbookRow), e.Action))
End If
End Sub
Public Sub RemoveaddressbookRow(ByVal row As addressbookRow)
Me.Rows.Remove(row)
End Sub
End Class
<System.Diagnostics.DebuggerStepThrough()> _
Public Class addressbookRow
Inherits DataRow
Private tableaddressbook As addressbookDataTable
Friend Sub New(ByVal rb As DataRowBuilder)
MyBase.New(rb)
Me.tableaddressbook = CType(Me.Table,addressbookDataTable)
End Sub
Public Property address As String
Get
Try
Return CType(Me(Me.tableaddressbook.addressColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tableaddressbook.addressColumn) = value
End Set
End Property
Public Property city As String
Get
Try
Return CType(Me(Me.tableaddressbook.cityColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tableaddressbook.cityColumn) = value
End Set
End Property
Public Property country As String
Get
Try
Return CType(Me(Me.tableaddressbook.countryColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tableaddressbook.countryColumn) = value
End Set
End Property
Public Property email As String
Get
Try
Return CType(Me(Me.tableaddressbook.emailColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tableaddressbook.emailColumn) = value
End Set
End Property
Public Property fax As String
Get
Try
Return CType(Me(Me.tableaddressbook.faxColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tableaddressbook.faxColumn) = value
End Set
End Property
Public Property firstname As String
Get
Try
Return CType(Me(Me.tableaddressbook.firstnameColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tableaddressbook.firstnameColumn) = value
End Set
End Property
Public Property idnumber As String
Get
Return CType(Me(Me.tableaddressbook.idnumberColumn),String)
End Get
Set
Me(Me.tableaddressbook.idnumberColumn) = value
End Set
End Property
Public Property lastname As String
Get
Try
Return CType(Me(Me.tableaddressbook.lastnameColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tableaddressbook.lastnameColumn) = value
End Set
End Property
Public Property pc As String
Get
Try
Return CType(Me(Me.tableaddressbook.pcColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tableaddressbook.pcColumn) = value
End Set
End Property
Public Property phone As String
Get
Try
Return CType(Me(Me.tableaddressbook.phoneColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tableaddressbook.phoneColumn) = value
End Set
End Property
Public Property state As String
Get
Try
Return CType(Me(Me.tableaddressbook.stateColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.tableaddressbook.stateColumn) = value
End Set
End Property
Public Function IsaddressNull() As Boolean
Return Me.IsNull(Me.tableaddressbook.addressColumn)
End Function
Public Sub SetaddressNull()
Me(Me.tableaddressbook.addressColumn) = System.Convert.DBNull
End Sub
Public Function IscityNull() As Boolean
Return Me.IsNull(Me.tableaddressbook.cityColumn)
End Function
Public Sub SetcityNull()
Me(Me.tableaddressbook.cityColumn) = System.Convert.DBNull
End Sub
Public Function IscountryNull() As Boolean
Return Me.IsNull(Me.tableaddressbook.countryColumn)
End Function
Public Sub SetcountryNull()
Me(Me.tableaddressbook.countryColumn) = System.Convert.DBNull
End Sub
Public Function IsemailNull() As Boolean
Return Me.IsNull(Me.tableaddressbook.emailColumn)
End Function
Public Sub SetemailNull()
Me(Me.tableaddressbook.emailColumn) = System.Convert.DBNull
End Sub
Public Function IsfaxNull() As Boolean
Return Me.IsNull(Me.tableaddressbook.faxColumn)
End Function
Public Sub SetfaxNull()
Me(Me.tableaddressbook.faxColumn) = System.Convert.DBNull
End Sub
Public Function IsfirstnameNull() As Boolean
Return Me.IsNull(Me.tableaddressbook.firstnameColumn)
End Function
Public Sub SetfirstnameNull()
Me(Me.tableaddressbook.firstnameColumn) = System.Convert.DBNull
End Sub
Public Function IslastnameNull() As Boolean
Return Me.IsNull(Me.tableaddressbook.lastnameColumn)
End Function
Public Sub SetlastnameNull()
Me(Me.tableaddressbook.lastnameColumn) = System.Convert.DBNull
End Sub
Public Function IspcNull() As Boolean
Return Me.IsNull(Me.tableaddressbook.pcColumn)
End Function
Public Sub SetpcNull()
Me(Me.tableaddressbook.pcColumn) = System.Convert.DBNull
End Sub
Public Function IsphoneNull() As Boolean
Return Me.IsNull(Me.tableaddressbook.phoneColumn)
End Function
Public Sub SetphoneNull()
Me(Me.tableaddressbook.phoneColumn) = System.Convert.DBNull
End Sub
Public Function IsstateNull() As Boolean
Return Me.IsNull(Me.tableaddressbook.stateColumn)
End Function
Public Sub SetstateNull()
Me(Me.tableaddressbook.stateColumn) = System.Convert.DBNull
End Sub
End Class
<System.Diagnostics.DebuggerStepThrough()> _
Public Class addressbookRowChangeEvent
Inherits EventArgs
Private eventRow As addressbookRow
Private eventAction As DataRowAction
Public Sub New(ByVal row As addressbookRow, ByVal action As DataRowAction)
MyBase.New
Me.eventRow = row
Me.eventAction = action
End Sub
Public ReadOnly Property Row As addressbookRow
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 + -