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

📄 frmresult.vb

📁 教务管理系统:学生成绩管理
💻 VB
📖 第 1 页 / 共 2 页
字号:

Imports System.IO

Imports System.Data.SqlClient

Public Class FrmResult
    Inherits System.Windows.Forms.Form

#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 DataGrid1 As System.Windows.Forms.DataGrid
    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
    Friend WithEvents BtnExit As System.Windows.Forms.Button
    Friend WithEvents BtnDel As System.Windows.Forms.Button
    Friend WithEvents BtnEdit As System.Windows.Forms.Button
    Friend WithEvents BtnAdd As System.Windows.Forms.Button
    Friend WithEvents CmbCourse As System.Windows.Forms.ComboBox
    Friend WithEvents LblCourse As System.Windows.Forms.Label
    Friend WithEvents InDate As System.Windows.Forms.DateTimePicker
    Friend WithEvents TxtTeacher As System.Windows.Forms.TextBox
    Friend WithEvents TxtResult As System.Windows.Forms.TextBox
    Friend WithEvents LblInDate As System.Windows.Forms.Label
    Friend WithEvents LblTeacher As System.Windows.Forms.Label
    Friend WithEvents LblResult As System.Windows.Forms.Label
    Friend WithEvents CmbStudent As System.Windows.Forms.ComboBox
    Friend WithEvents LblStudent As System.Windows.Forms.Label
    Friend WithEvents CmbClass As System.Windows.Forms.ComboBox
    Friend WithEvents LblClass As System.Windows.Forms.Label
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.DataGrid1 = New System.Windows.Forms.DataGrid
        Me.GroupBox1 = New System.Windows.Forms.GroupBox
        Me.CmbCourse = New System.Windows.Forms.ComboBox
        Me.LblCourse = New System.Windows.Forms.Label
        Me.BtnExit = New System.Windows.Forms.Button
        Me.BtnDel = New System.Windows.Forms.Button
        Me.BtnEdit = New System.Windows.Forms.Button
        Me.BtnAdd = New System.Windows.Forms.Button
        Me.InDate = New System.Windows.Forms.DateTimePicker
        Me.TxtTeacher = New System.Windows.Forms.TextBox
        Me.TxtResult = New System.Windows.Forms.TextBox
        Me.LblInDate = New System.Windows.Forms.Label
        Me.LblTeacher = New System.Windows.Forms.Label
        Me.LblResult = New System.Windows.Forms.Label
        Me.CmbStudent = New System.Windows.Forms.ComboBox
        Me.LblStudent = New System.Windows.Forms.Label
        Me.CmbClass = New System.Windows.Forms.ComboBox
        Me.LblClass = New System.Windows.Forms.Label
        CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.GroupBox1.SuspendLayout()
        Me.SuspendLayout()
        '
        'DataGrid1
        '
        Me.DataGrid1.DataMember = ""
        Me.DataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText
        Me.DataGrid1.Location = New System.Drawing.Point(8, 8)
        Me.DataGrid1.Name = "DataGrid1"
        Me.DataGrid1.Size = New System.Drawing.Size(344, 392)
        Me.DataGrid1.TabIndex = 0
        '
        'GroupBox1
        '
        Me.GroupBox1.Controls.Add(Me.CmbCourse)
        Me.GroupBox1.Controls.Add(Me.LblCourse)
        Me.GroupBox1.Controls.Add(Me.BtnExit)
        Me.GroupBox1.Controls.Add(Me.BtnDel)
        Me.GroupBox1.Controls.Add(Me.BtnEdit)
        Me.GroupBox1.Controls.Add(Me.BtnAdd)
        Me.GroupBox1.Controls.Add(Me.InDate)
        Me.GroupBox1.Controls.Add(Me.TxtTeacher)
        Me.GroupBox1.Controls.Add(Me.TxtResult)
        Me.GroupBox1.Controls.Add(Me.LblInDate)
        Me.GroupBox1.Controls.Add(Me.LblTeacher)
        Me.GroupBox1.Controls.Add(Me.LblResult)
        Me.GroupBox1.Controls.Add(Me.CmbStudent)
        Me.GroupBox1.Controls.Add(Me.LblStudent)
        Me.GroupBox1.Controls.Add(Me.CmbClass)
        Me.GroupBox1.Controls.Add(Me.LblClass)
        Me.GroupBox1.Location = New System.Drawing.Point(360, 0)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(160, 400)
        Me.GroupBox1.TabIndex = 14
        Me.GroupBox1.TabStop = False
        '
        'CmbCourse
        '
        Me.CmbCourse.Location = New System.Drawing.Point(8, 72)
        Me.CmbCourse.Name = "CmbCourse"
        Me.CmbCourse.Size = New System.Drawing.Size(144, 20)
        Me.CmbCourse.TabIndex = 19
        '
        'LblCourse
        '
        Me.LblCourse.Location = New System.Drawing.Point(8, 56)
        Me.LblCourse.Name = "LblCourse"
        Me.LblCourse.Size = New System.Drawing.Size(136, 16)
        Me.LblCourse.TabIndex = 18
        Me.LblCourse.Text = "请选择课程:"
        '
        'BtnExit
        '
        Me.BtnExit.Location = New System.Drawing.Point(24, 360)
        Me.BtnExit.Name = "BtnExit"
        Me.BtnExit.Size = New System.Drawing.Size(80, 24)
        Me.BtnExit.TabIndex = 17
        Me.BtnExit.Text = "退出"
        '
        'BtnDel
        '
        Me.BtnDel.Location = New System.Drawing.Point(24, 328)
        Me.BtnDel.Name = "BtnDel"
        Me.BtnDel.Size = New System.Drawing.Size(80, 24)
        Me.BtnDel.TabIndex = 16
        Me.BtnDel.Text = "删除记录"
        '
        'BtnEdit
        '
        Me.BtnEdit.Location = New System.Drawing.Point(24, 296)
        Me.BtnEdit.Name = "BtnEdit"
        Me.BtnEdit.Size = New System.Drawing.Size(80, 24)
        Me.BtnEdit.TabIndex = 15
        Me.BtnEdit.Text = "修改记录"
        '
        'BtnAdd
        '
        Me.BtnAdd.Location = New System.Drawing.Point(24, 264)
        Me.BtnAdd.Name = "BtnAdd"
        Me.BtnAdd.Size = New System.Drawing.Size(80, 24)
        Me.BtnAdd.TabIndex = 14
        Me.BtnAdd.Text = "添加记录"
        '
        'InDate
        '
        Me.InDate.Location = New System.Drawing.Point(8, 232)
        Me.InDate.Name = "InDate"
        Me.InDate.Size = New System.Drawing.Size(144, 21)
        Me.InDate.TabIndex = 12
        '
        'TxtTeacher
        '
        Me.TxtTeacher.Location = New System.Drawing.Point(8, 192)
        Me.TxtTeacher.Name = "TxtTeacher"
        Me.TxtTeacher.Size = New System.Drawing.Size(144, 21)
        Me.TxtTeacher.TabIndex = 11
        Me.TxtTeacher.Text = ""
        '
        'TxtResult
        '
        Me.TxtResult.Location = New System.Drawing.Point(8, 152)
        Me.TxtResult.Name = "TxtResult"
        Me.TxtResult.Size = New System.Drawing.Size(144, 21)
        Me.TxtResult.TabIndex = 10
        Me.TxtResult.Text = ""
        '
        'LblInDate
        '
        Me.LblInDate.Location = New System.Drawing.Point(8, 216)
        Me.LblInDate.Name = "LblInDate"
        Me.LblInDate.Size = New System.Drawing.Size(136, 16)
        Me.LblInDate.TabIndex = 8
        Me.LblInDate.Text = "录入时间:"
        '
        'LblTeacher
        '
        Me.LblTeacher.Location = New System.Drawing.Point(8, 176)
        Me.LblTeacher.Name = "LblTeacher"
        Me.LblTeacher.Size = New System.Drawing.Size(136, 16)
        Me.LblTeacher.TabIndex = 6
        Me.LblTeacher.Text = "教师姓名:"
        '
        'LblResult
        '
        Me.LblResult.Location = New System.Drawing.Point(8, 136)
        Me.LblResult.Name = "LblResult"
        Me.LblResult.Size = New System.Drawing.Size(136, 16)
        Me.LblResult.TabIndex = 4
        Me.LblResult.Text = "请输入成绩:"
        '
        'CmbStudent
        '
        Me.CmbStudent.Location = New System.Drawing.Point(8, 112)
        Me.CmbStudent.Name = "CmbStudent"
        Me.CmbStudent.Size = New System.Drawing.Size(144, 20)
        Me.CmbStudent.TabIndex = 3
        '
        'LblStudent
        '
        Me.LblStudent.Location = New System.Drawing.Point(8, 96)
        Me.LblStudent.Name = "LblStudent"
        Me.LblStudent.Size = New System.Drawing.Size(136, 16)
        Me.LblStudent.TabIndex = 2
        Me.LblStudent.Text = "请选择学号:"
        '
        'CmbClass
        '
        Me.CmbClass.Location = New System.Drawing.Point(8, 32)
        Me.CmbClass.Name = "CmbClass"
        Me.CmbClass.Size = New System.Drawing.Size(144, 20)
        Me.CmbClass.TabIndex = 1
        '
        'LblClass
        '
        Me.LblClass.Location = New System.Drawing.Point(8, 16)
        Me.LblClass.Name = "LblClass"
        Me.LblClass.Size = New System.Drawing.Size(136, 16)
        Me.LblClass.TabIndex = 0
        Me.LblClass.Text = "请选择班级:"
        '
        'FrmResult
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(528, 414)
        Me.Controls.Add(Me.GroupBox1)
        Me.Controls.Add(Me.DataGrid1)
        Me.Name = "FrmResult"
        Me.Text = "成绩管理"
        CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).EndInit()
        Me.GroupBox1.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub FrmResult_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
        BindData()
        addCmbClass()
        addCmbCourse()
        If DataGrid1.VisibleRowCount > 0 Then
            bindTextBox(0)
        End If
    End Sub
    Private Sub BindData()
        Try
            Dim sql As String = "SELECT C.CLASSID AS '班级编号',B.COURSENAME AS '课程',C.STUDENTID AS '学生编号',C.STUDENTNAME AS '学生姓名',A.RESULT AS '分数',A.TEACHER AS '评分教师',A.INDATE AS '录入时间' FROM RESULTINFO A,COURSEINFO B,STUDENTINFO C  WHERE A.COURSEID=B.COURSEID AND A.STUDENTID=C.STUDENTID"
            Dim dt As DataTable = GetDataTable(sql)
            If dt.Rows.Count <> 0 Then
                DataGrid1.DataSource = dt
            End If
        Catch ex As Exception
            WriteErr(ex)
        End Try

    End Sub


    Private Sub bindTextBox(ByVal row As Int16)
        Dim STR1 As String
        Dim STR2 As String
        Me.CmbClass.Text = BindClass(Me.DataGrid1.Item(row, 0))
        Me.CmbCourse.Text = Me.DataGrid1.Item(row, 1)
        STR1 = Me.DataGrid1.Item(row, 2)
        STR2 = Me.DataGrid1.Item(row, 3)
        Me.CmbStudent.Text = STR2 + "|" + STR1
        Me.TxtResult.Text = Me.DataGrid1.Item(row, 4)
        Me.TxtTeacher.Text = Me.DataGrid1.Item(row, 5)
        Me.InDate.Value = Me.DataGrid1.Item(row, 6)
    End Sub

    Private Sub addCmbClass()
        Dim str1 As String
        Dim str2 As String

⌨️ 快捷键说明

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