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

📄 frmreport.vb

📁 vb.net+SQL开发工具 是一个很好的管理系统的源码
💻 VB
字号:
Public Class frmReport
    Inherits System.Windows.Forms.Form
    Private dtData As DataTable
#Region " Windows 窗体设计器生成的代码 "

    Public Sub New()
        MyBase.New()

        '该调用是 Windows 窗体设计器所必需的。
        InitializeComponent()

        '在 InitializeComponent() 调用之后添加任何初始化

    End Sub

    '窗体重写 dispose 以清理组件列表。
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Windows 窗体设计器所必需的
    Private components As System.ComponentModel.IContainer

    '注意: 以下过程是 Windows 窗体设计器所必需的
    '可以使用 Windows 窗体设计器修改此过程。
    '不要使用代码编辑器修改它。
    Friend WithEvents grbSearch As System.Windows.Forms.GroupBox
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents dgdList As System.Windows.Forms.DataGrid
    Friend WithEvents btnPrint As System.Windows.Forms.Button
    Friend WithEvents txbClass As System.Windows.Forms.TextBox
    Friend WithEvents txbName As System.Windows.Forms.TextBox
    Friend WithEvents txbId As System.Windows.Forms.TextBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmReport))
        Me.grbSearch = New System.Windows.Forms.GroupBox
        Me.btnPrint = New System.Windows.Forms.Button
        Me.Label3 = New System.Windows.Forms.Label
        Me.txbClass = New System.Windows.Forms.TextBox
        Me.txbName = New System.Windows.Forms.TextBox
        Me.Label2 = New System.Windows.Forms.Label
        Me.Label1 = New System.Windows.Forms.Label
        Me.txbId = New System.Windows.Forms.TextBox
        Me.dgdList = New System.Windows.Forms.DataGrid
        Me.grbSearch.SuspendLayout()
        CType(Me.dgdList, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'grbSearch
        '
        Me.grbSearch.Controls.Add(Me.btnPrint)
        Me.grbSearch.Controls.Add(Me.Label3)
        Me.grbSearch.Controls.Add(Me.txbClass)
        Me.grbSearch.Controls.Add(Me.txbName)
        Me.grbSearch.Controls.Add(Me.Label2)
        Me.grbSearch.Controls.Add(Me.Label1)
        Me.grbSearch.Controls.Add(Me.txbId)
        Me.grbSearch.Dock = System.Windows.Forms.DockStyle.Top
        Me.grbSearch.Location = New System.Drawing.Point(0, 0)
        Me.grbSearch.Name = "grbSearch"
        Me.grbSearch.Size = New System.Drawing.Size(528, 39)
        Me.grbSearch.TabIndex = 3
        Me.grbSearch.TabStop = False
        Me.grbSearch.Text = "学生信息"
        '
        'btnPrint
        '
        Me.btnPrint.Location = New System.Drawing.Point(368, 10)
        Me.btnPrint.Name = "btnPrint"
        Me.btnPrint.TabIndex = 7
        Me.btnPrint.Text = "打印"
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(248, 16)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(32, 15)
        Me.Label3.TabIndex = 6
        Me.Label3.Text = "班级"
        '
        'txbClass
        '
        Me.txbClass.Location = New System.Drawing.Point(280, 11)
        Me.txbClass.Name = "txbClass"
        Me.txbClass.ReadOnly = True
        Me.txbClass.Size = New System.Drawing.Size(56, 21)
        Me.txbClass.TabIndex = 5
        Me.txbClass.Text = ""
        '
        'txbName
        '
        Me.txbName.Location = New System.Drawing.Point(184, 11)
        Me.txbName.Name = "txbName"
        Me.txbName.ReadOnly = True
        Me.txbName.Size = New System.Drawing.Size(56, 21)
        Me.txbName.TabIndex = 4
        Me.txbName.Text = ""
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(152, 16)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(32, 15)
        Me.Label2.TabIndex = 3
        Me.Label2.Text = "姓名"
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(24, 16)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(32, 15)
        Me.Label1.TabIndex = 2
        Me.Label1.Text = "学号"
        '
        'txbId
        '
        Me.txbId.Location = New System.Drawing.Point(56, 11)
        Me.txbId.Name = "txbId"
        Me.txbId.Size = New System.Drawing.Size(88, 21)
        Me.txbId.TabIndex = 1
        Me.txbId.Text = ""
        '
        'dgdList
        '
        Me.dgdList.CaptionVisible = False
        Me.dgdList.DataMember = ""
        Me.dgdList.Dock = System.Windows.Forms.DockStyle.Fill
        Me.dgdList.HeaderForeColor = System.Drawing.SystemColors.ControlText
        Me.dgdList.Location = New System.Drawing.Point(0, 39)
        Me.dgdList.Name = "dgdList"
        Me.dgdList.Size = New System.Drawing.Size(528, 234)
        Me.dgdList.TabIndex = 4
        '
        'frmReport
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(528, 273)
        Me.Controls.Add(Me.dgdList)
        Me.Controls.Add(Me.grbSearch)
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.Name = "frmReport"
        Me.Text = "打印成绩单"
        Me.grbSearch.ResumeLayout(False)
        CType(Me.dgdList, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub txbId_KeyDown(ByVal sender As Object, ByVal _
    e As System.Windows.Forms.KeyEventArgs) Handles txbId.KeyDown
        If e.KeyCode = Keys.Enter And txbId.Text.Trim.Length <> 0 Then
            Dim db As DataBase = New DataBase
            Dim dv As DataView
            Dim strSQL As String = "select 姓名, 班级名称, 学籍编号 from"
            strSQL += " 学生信息 as a, 班级信息 as b where a.班级编号="
            strSQL += "b.班级编号 and 学号='" + Me.txbId.Text.Trim + "'"
            dv = db.RunSelectSQL(strSQL)
            If dv.Count = 0 Then
                MessageBox.Show("学号错误!")
                Exit Sub
            End If
            Me.txbName.Text = dv(0)("姓名").ToString()
            Me.txbClass.Text = dv(0)("班级名称").ToString()
            strSQL = "select b.课程名称,b.开课系别,b.教师,a.成绩 from "
            strSQL += "成绩表 as a,  课程信息 as b where a.课程编号="
            strSQL += "b.课程编号  and 学号='" + Me.txbId.Text.Trim
            strSQL += " ' order by a.课程编号"

            dv = db.RunSelectSQL(strSQL)

            Me.dgdList.DataSource = dv
            dv.AllowDelete = False
            dv.AllowEdit = False
            dv.AllowNew = False
            dtData = dv.Table
            Me.dgdList.AllowSorting = False
            db.Dispose()
        End If
    End Sub

    Private Sub btnPrint_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles btnPrint.Click
        Dim childFrm As frmPrint = New frmPrint(dtData)
        childFrm.ShowDialog()
    End Sub

End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -