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

📄 students.vb

📁 档案管理系统
💻 VB
字号:
Public Class frmStudents
    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 grdResult As System.Windows.Forms.DataGrid
    Friend WithEvents DataGridTableStyle1 As System.Windows.Forms.DataGridTableStyle
    Friend WithEvents DataGridTextBoxColumn1 As System.Windows.Forms.DataGridTextBoxColumn
    Friend WithEvents DataGridTextBoxColumn2 As System.Windows.Forms.DataGridTextBoxColumn
    Friend WithEvents btnInfo As System.Windows.Forms.Button
    Friend WithEvents stbStudent As System.Windows.Forms.StatusBar
    Friend WithEvents btnReport As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.grdResult = New System.Windows.Forms.DataGrid
        Me.DataGridTableStyle1 = New System.Windows.Forms.DataGridTableStyle
        Me.DataGridTextBoxColumn1 = New System.Windows.Forms.DataGridTextBoxColumn
        Me.DataGridTextBoxColumn2 = New System.Windows.Forms.DataGridTextBoxColumn
        Me.btnInfo = New System.Windows.Forms.Button
        Me.stbStudent = New System.Windows.Forms.StatusBar
        Me.btnReport = New System.Windows.Forms.Button
        CType(Me.grdResult, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'grdResult
        '
        Me.grdResult.DataMember = ""
        Me.grdResult.HeaderForeColor = System.Drawing.SystemColors.ControlText
        Me.grdResult.Location = New System.Drawing.Point(16, 16)
        Me.grdResult.Name = "grdResult"
        Me.grdResult.ReadOnly = True
        Me.grdResult.Size = New System.Drawing.Size(224, 296)
        Me.grdResult.TabIndex = 0
        Me.grdResult.TableStyles.AddRange(New System.Windows.Forms.DataGridTableStyle() {Me.DataGridTableStyle1})
        '
        'DataGridTableStyle1
        '
        Me.DataGridTableStyle1.DataGrid = Me.grdResult
        Me.DataGridTableStyle1.GridColumnStyles.AddRange(New System.Windows.Forms.DataGridColumnStyle() {Me.DataGridTextBoxColumn1, Me.DataGridTextBoxColumn2})
        Me.DataGridTableStyle1.HeaderForeColor = System.Drawing.SystemColors.ControlText
        Me.DataGridTableStyle1.MappingName = "Table"
        Me.DataGridTableStyle1.ReadOnly = True
        '
        'DataGridTextBoxColumn1
        '
        Me.DataGridTextBoxColumn1.Format = ""
        Me.DataGridTextBoxColumn1.FormatInfo = Nothing
        Me.DataGridTextBoxColumn1.HeaderText = "学号"
        Me.DataGridTextBoxColumn1.MappingName = "学号"
        Me.DataGridTextBoxColumn1.Width = 75
        '
        'DataGridTextBoxColumn2
        '
        Me.DataGridTextBoxColumn2.Format = ""
        Me.DataGridTextBoxColumn2.FormatInfo = Nothing
        Me.DataGridTextBoxColumn2.HeaderText = "姓名"
        Me.DataGridTextBoxColumn2.MappingName = "姓名"
        Me.DataGridTextBoxColumn2.Width = 75
        '
        'btnInfo
        '
        Me.btnInfo.Location = New System.Drawing.Point(256, 16)
        Me.btnInfo.Name = "btnInfo"
        Me.btnInfo.Size = New System.Drawing.Size(64, 24)
        Me.btnInfo.TabIndex = 1
        Me.btnInfo.Text = "详细信息"
        '
        'stbStudent
        '
        Me.stbStudent.Location = New System.Drawing.Point(0, 327)
        Me.stbStudent.Name = "stbStudent"
        Me.stbStudent.Size = New System.Drawing.Size(336, 22)
        Me.stbStudent.TabIndex = 2
        '
        'btnReport
        '
        Me.btnReport.Location = New System.Drawing.Point(256, 48)
        Me.btnReport.Name = "btnReport"
        Me.btnReport.Size = New System.Drawing.Size(64, 24)
        Me.btnReport.TabIndex = 1
        Me.btnReport.Text = "输出报表"
        '
        'frmStudents
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(336, 349)
        Me.Controls.Add(Me.stbStudent)
        Me.Controls.Add(Me.btnInfo)
        Me.Controls.Add(Me.grdResult)
        Me.Controls.Add(Me.btnReport)
        Me.MaximizeBox = False
        Me.Name = "frmStudents"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "查询结果"
        CType(Me.grdResult, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub frmStudents_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        grdResult.SetDataBinding(stdDataSet, "Table")
        stbStudent.Text = "共找到" & stdDataSet.Tables(0).Rows.Count & "条记录"
    End Sub

    Private Sub btnInfo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInfo.Click
        If grdResult.CurrentRowIndex >= 0 Then
            Dim frm As New frmRegister
            frm.type = 1
            frm.id = grdResult.Item(grdResult.CurrentRowIndex, 0)
            frm.MdiParent = Me.MdiParent
            frm.Show()
        End If
    End Sub

    Private Sub grdResult_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles grdResult.MouseDown
        Dim hit As DataGrid.HitTestInfo

        hit = grdResult.HitTest(e.X, e.Y)
        If hit.Type = DataGrid.HitTestType.Cell Or hit.Type = DataGrid.HitTestType.RowHeader Then
            stbStudent.Text = "共" & stdDataSet.Tables(0).Rows.Count & "条记录,当前选择第" & hit.Row + 1 & "条记录"
        End If
    End Sub

    
    Private Sub btnReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReport.Click
        Dim frm As New frmStdReport
        frm.ShowDialog()
    End Sub
End Class

⌨️ 快捷键说明

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