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

📄 print.vb

📁 “代码”目录下的程序
💻 VB
📖 第 1 页 / 共 2 页
字号:
            rowPrintRow.ItemArray = New Object() {课程名称, 开课系别, 教师, 成绩, 学号}
            Me.Rows.Add(rowPrintRow)
            Return rowPrintRow
        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 PrintDataTable = CType(MyBase.Clone,PrintDataTable)
            cln.InitVars
            Return cln
        End Function
        
        Protected Overrides Function CreateInstance() As DataTable
            Return New PrintDataTable
        End Function
        
        Friend Sub InitVars()
            Me.column课程名称 = Me.Columns("课程名称")
            Me.column开课系别 = Me.Columns("开课系别")
            Me.column教师 = Me.Columns("教师")
            Me.column成绩 = Me.Columns("成绩")
            Me.column学号 = Me.Columns("学号")
        End Sub
        
        Private Sub InitClass()
            Me.column课程名称 = New DataColumn("课程名称", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.column课程名称)
            Me.column开课系别 = New DataColumn("开课系别", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.column开课系别)
            Me.column教师 = New DataColumn("教师", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.column教师)
            Me.column成绩 = New DataColumn("成绩", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.column成绩)
            Me.column学号 = New DataColumn("学号", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.column学号)
        End Sub
        
        Public Function NewPrintRow() As PrintRow
            Return CType(Me.NewRow,PrintRow)
        End Function
        
        Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow
            Return New PrintRow(builder)
        End Function
        
        Protected Overrides Function GetRowType() As System.Type
            Return GetType(PrintRow)
        End Function
        
        Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowChanged(e)
            If (Not (Me.PrintRowChangedEvent) Is Nothing) Then
                RaiseEvent PrintRowChanged(Me, New PrintRowChangeEvent(CType(e.Row,PrintRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowChanging(e)
            If (Not (Me.PrintRowChangingEvent) Is Nothing) Then
                RaiseEvent PrintRowChanging(Me, New PrintRowChangeEvent(CType(e.Row,PrintRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowDeleted(e)
            If (Not (Me.PrintRowDeletedEvent) Is Nothing) Then
                RaiseEvent PrintRowDeleted(Me, New PrintRowChangeEvent(CType(e.Row,PrintRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowDeleting(e)
            If (Not (Me.PrintRowDeletingEvent) Is Nothing) Then
                RaiseEvent PrintRowDeleting(Me, New PrintRowChangeEvent(CType(e.Row,PrintRow), e.Action))
            End If
        End Sub
        
        Public Sub RemovePrintRow(ByVal row As PrintRow)
            Me.Rows.Remove(row)
        End Sub
    End Class
    
    <System.Diagnostics.DebuggerStepThrough()>  _
    Public Class PrintRow
        Inherits DataRow
        
        Private tablePrint As PrintDataTable
        
        Friend Sub New(ByVal rb As DataRowBuilder)
            MyBase.New(rb)
            Me.tablePrint = CType(Me.Table,PrintDataTable)
        End Sub
        
        Public Property 课程名称 As String
            Get
                Try 
                    Return CType(Me(Me.tablePrint.课程名称Column),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tablePrint.课程名称Column) = value
            End Set
        End Property
        
        Public Property 开课系别 As String
            Get
                Try 
                    Return CType(Me(Me.tablePrint.开课系别Column),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tablePrint.开课系别Column) = value
            End Set
        End Property
        
        Public Property 教师 As String
            Get
                Try 
                    Return CType(Me(Me.tablePrint.教师Column),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tablePrint.教师Column) = value
            End Set
        End Property
        
        Public Property 成绩 As String
            Get
                Try 
                    Return CType(Me(Me.tablePrint.成绩Column),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tablePrint.成绩Column) = value
            End Set
        End Property
        
        Public Property 学号 As String
            Get
                Try 
                    Return CType(Me(Me.tablePrint.学号Column),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
                End Try
            End Get
            Set
                Me(Me.tablePrint.学号Column) = value
            End Set
        End Property
        
        Public Function Is课程名称Null() As Boolean
            Return Me.IsNull(Me.tablePrint.课程名称Column)
        End Function
        
        Public Sub Set课程名称Null()
            Me(Me.tablePrint.课程名称Column) = System.Convert.DBNull
        End Sub
        
        Public Function Is开课系别Null() As Boolean
            Return Me.IsNull(Me.tablePrint.开课系别Column)
        End Function
        
        Public Sub Set开课系别Null()
            Me(Me.tablePrint.开课系别Column) = System.Convert.DBNull
        End Sub
        
        Public Function Is教师Null() As Boolean
            Return Me.IsNull(Me.tablePrint.教师Column)
        End Function
        
        Public Sub Set教师Null()
            Me(Me.tablePrint.教师Column) = System.Convert.DBNull
        End Sub
        
        Public Function Is成绩Null() As Boolean
            Return Me.IsNull(Me.tablePrint.成绩Column)
        End Function
        
        Public Sub Set成绩Null()
            Me(Me.tablePrint.成绩Column) = System.Convert.DBNull
        End Sub
        
        Public Function Is学号Null() As Boolean
            Return Me.IsNull(Me.tablePrint.学号Column)
        End Function
        
        Public Sub Set学号Null()
            Me(Me.tablePrint.学号Column) = System.Convert.DBNull
        End Sub
    End Class
    
    <System.Diagnostics.DebuggerStepThrough()>  _
    Public Class PrintRowChangeEvent
        Inherits EventArgs
        
        Private eventRow As PrintRow
        
        Private eventAction As DataRowAction
        
        Public Sub New(ByVal row As PrintRow, ByVal action As DataRowAction)
            MyBase.New
            Me.eventRow = row
            Me.eventAction = action
        End Sub
        
        Public ReadOnly Property Row As PrintRow
            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 + -