⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testdataset.vb

📁 《VBA专业项目实例开发》源代码,学习vba必备
💻 VB
📖 第 1 页 / 共 2 页
字号:
            Me.columnClient_ID.Unique = true
        End Sub
        
        Public Function NewtblClientsRow() As tblClientsRow
            Return CType(Me.NewRow,tblClientsRow)
        End Function
        
        Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow
            Return New tblClientsRow(builder)
        End Function
        
        Protected Overrides Function GetRowType() As System.Type
            Return GetType(tblClientsRow)
        End Function
        
        Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowChanged(e)
            If (Not (Me.tblClientsRowChangedEvent) Is Nothing) Then
                RaiseEvent tblClientsRowChanged(Me, New tblClientsRowChangeEvent(CType(e.Row,tblClientsRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowChanging(e)
            If (Not (Me.tblClientsRowChangingEvent) Is Nothing) Then
                RaiseEvent tblClientsRowChanging(Me, New tblClientsRowChangeEvent(CType(e.Row,tblClientsRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowDeleted(e)
            If (Not (Me.tblClientsRowDeletedEvent) Is Nothing) Then
                RaiseEvent tblClientsRowDeleted(Me, New tblClientsRowChangeEvent(CType(e.Row,tblClientsRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowDeleting(e)
            If (Not (Me.tblClientsRowDeletingEvent) Is Nothing) Then
                RaiseEvent tblClientsRowDeleting(Me, New tblClientsRowChangeEvent(CType(e.Row,tblClientsRow), e.Action))
            End If
        End Sub
        
        Public Sub RemovetblClientsRow(ByVal row As tblClientsRow)
            Me.Rows.Remove(row)
        End Sub
    End Class
    
    <System.Diagnostics.DebuggerStepThrough()>  _
    Public Class tblClientsRow
        Inherits DataRow
        
        Private tabletblClients As tblClientsDataTable
        
        Friend Sub New(ByVal rb As DataRowBuilder)
            MyBase.New(rb)
            Me.tabletblClients = CType(Me.Table,tblClientsDataTable)
        End Sub
        
        Public Property Address_Line1 As String
            Get
                Try 
                    Return CType(Me(Me.tabletblClients.Address_Line1Column),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tabletblClients.Address_Line1Column) = value
            End Set
        End Property
        
        Public Property Address_Line2 As String
            Get
                Try 
                    Return CType(Me(Me.tabletblClients.Address_Line2Column),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tabletblClients.Address_Line2Column) = value
            End Set
        End Property
        
        Public Property CellPhoneNumber As String
            Get
                Try 
                    Return CType(Me(Me.tabletblClients.CellPhoneNumberColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tabletblClients.CellPhoneNumberColumn) = value
            End Set
        End Property
        
        Public Property City As String
            Get
                Try 
                    Return CType(Me(Me.tabletblClients.CityColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tabletblClients.CityColumn) = value
            End Set
        End Property
        
        Public Property Client_ID As Integer
            Get
                Return CType(Me(Me.tabletblClients.Client_IDColumn),Integer)
            End Get
            Set
                Me(Me.tabletblClients.Client_IDColumn) = value
            End Set
        End Property
        
        Public Property Client_Name As String
            Get
                Try 
                    Return CType(Me(Me.tabletblClients.Client_NameColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tabletblClients.Client_NameColumn) = value
            End Set
        End Property
        
        Public Property Contact_Person As String
            Get
                Try 
                    Return CType(Me(Me.tabletblClients.Contact_PersonColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tabletblClients.Contact_PersonColumn) = value
            End Set
        End Property
        
        Public Property EmailAddress As String
            Get
                Try 
                    Return CType(Me(Me.tabletblClients.EmailAddressColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tabletblClients.EmailAddressColumn) = value
            End Set
        End Property
        
        Public Property Fax As String
            Get
                Try 
                    Return CType(Me(Me.tabletblClients.FaxColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tabletblClients.FaxColumn) = value
            End Set
        End Property
        
        Public Property PhoneNumber As String
            Get
                Try 
                    Return CType(Me(Me.tabletblClients.PhoneNumberColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tabletblClients.PhoneNumberColumn) = value
            End Set
        End Property
        
        Public Property Remarks As String
            Get
                Try 
                    Return CType(Me(Me.tabletblClients.RemarksColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tabletblClients.RemarksColumn) = value
            End Set
        End Property
        
        Public Property State As String
            Get
                Try 
                    Return CType(Me(Me.tabletblClients.StateColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tabletblClients.StateColumn) = value
            End Set
        End Property
        
        Public Property Title As String
            Get
                Try 
                    Return CType(Me(Me.tabletblClients.TitleColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tabletblClients.TitleColumn) = value
            End Set
        End Property
        
        Public Property ZipCode As String
            Get
                Try 
                    Return CType(Me(Me.tabletblClients.ZipCodeColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tabletblClients.ZipCodeColumn) = value
            End Set
        End Property
        
        Public Function IsAddress_Line1Null() As Boolean
            Return Me.IsNull(Me.tabletblClients.Address_Line1Column)
        End Function
        
        Public Sub SetAddress_Line1Null()
            Me(Me.tabletblClients.Address_Line1Column) = System.Convert.DBNull
        End Sub
        
        Public Function IsAddress_Line2Null() As Boolean
            Return Me.IsNull(Me.tabletblClients.Address_Line2Column)
        End Function
        
        Public Sub SetAddress_Line2Null()
            Me(Me.tabletblClients.Address_Line2Column) = System.Convert.DBNull
        End Sub
        
        Public Function IsCellPhoneNumberNull() As Boolean
            Return Me.IsNull(Me.tabletblClients.CellPhoneNumberColumn)
        End Function
        
        Public Sub SetCellPhoneNumberNull()
            Me(Me.tabletblClients.CellPhoneNumberColumn) = System.Convert.DBNull
        End Sub
        
        Public Function IsCityNull() As Boolean
            Return Me.IsNull(Me.tabletblClients.CityColumn)
        End Function
        
        Public Sub SetCityNull()
            Me(Me.tabletblClients.CityColumn) = System.Convert.DBNull
        End Sub
        
        Public Function IsClient_NameNull() As Boolean
            Return Me.IsNull(Me.tabletblClients.Client_NameColumn)
        End Function
        
        Public Sub SetClient_NameNull()
            Me(Me.tabletblClients.Client_NameColumn) = System.Convert.DBNull
        End Sub
        
        Public Function IsContact_PersonNull() As Boolean
            Return Me.IsNull(Me.tabletblClients.Contact_PersonColumn)
        End Function
        
        Public Sub SetContact_PersonNull()
            Me(Me.tabletblClients.Contact_PersonColumn) = System.Convert.DBNull
        End Sub
        
        Public Function IsEmailAddressNull() As Boolean
            Return Me.IsNull(Me.tabletblClients.EmailAddressColumn)
        End Function
        
        Public Sub SetEmailAddressNull()
            Me(Me.tabletblClients.EmailAddressColumn) = System.Convert.DBNull
        End Sub
        
        Public Function IsFaxNull() As Boolean
            Return Me.IsNull(Me.tabletblClients.FaxColumn)
        End Function
        
        Public Sub SetFaxNull()
            Me(Me.tabletblClients.FaxColumn) = System.Convert.DBNull
        End Sub
        
        Public Function IsPhoneNumberNull() As Boolean
            Return Me.IsNull(Me.tabletblClients.PhoneNumberColumn)
        End Function
        
        Public Sub SetPhoneNumberNull()
            Me(Me.tabletblClients.PhoneNumberColumn) = System.Convert.DBNull
        End Sub
        
        Public Function IsRemarksNull() As Boolean
            Return Me.IsNull(Me.tabletblClients.RemarksColumn)
        End Function
        
        Public Sub SetRemarksNull()
            Me(Me.tabletblClients.RemarksColumn) = System.Convert.DBNull
        End Sub
        
        Public Function IsStateNull() As Boolean
            Return Me.IsNull(Me.tabletblClients.StateColumn)
        End Function
        
        Public Sub SetStateNull()
            Me(Me.tabletblClients.StateColumn) = System.Convert.DBNull
        End Sub
        
        Public Function IsTitleNull() As Boolean
            Return Me.IsNull(Me.tabletblClients.TitleColumn)
        End Function
        
        Public Sub SetTitleNull()
            Me(Me.tabletblClients.TitleColumn) = System.Convert.DBNull
        End Sub
        
        Public Function IsZipCodeNull() As Boolean
            Return Me.IsNull(Me.tabletblClients.ZipCodeColumn)
        End Function
        
        Public Sub SetZipCodeNull()
            Me(Me.tabletblClients.ZipCodeColumn) = System.Convert.DBNull
        End Sub
    End Class
    
    <System.Diagnostics.DebuggerStepThrough()>  _
    Public Class tblClientsRowChangeEvent
        Inherits EventArgs
        
        Private eventRow As tblClientsRow
        
        Private eventAction As DataRowAction
        
        Public Sub New(ByVal row As tblClientsRow, ByVal action As DataRowAction)
            MyBase.New
            Me.eventRow = row
            Me.eventAction = action
        End Sub
        
        Public ReadOnly Property Row As tblClientsRow
            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 + -