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

📄 formclassroom.vb

📁 学生信息管理系统
💻 VB
📖 第 1 页 / 共 2 页
字号:
        Me.btnOk.ForeColor = System.Drawing.SystemColors.Desktop
        Me.btnOk.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.btnOk.ImageIndex = 0
        Me.btnOk.ImageList = Me.ilButton
        Me.btnOk.Location = New System.Drawing.Point(24, 16)
        Me.btnOk.Name = "btnOk"
        Me.btnOk.Size = New System.Drawing.Size(96, 32)
        Me.btnOk.TabIndex = 0
        Me.btnOk.Text = "更新"
        Me.btnOk.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'Splitter1
        '
        Me.Splitter1.Dock = System.Windows.Forms.DockStyle.Bottom
        Me.Splitter1.Enabled = False
        Me.Splitter1.Location = New System.Drawing.Point(0, 362)
        Me.Splitter1.Name = "Splitter1"
        Me.Splitter1.Size = New System.Drawing.Size(416, 3)
        Me.Splitter1.TabIndex = 7
        Me.Splitter1.TabStop = False
        '
        'GroupBox1
        '
        Me.GroupBox1.Controls.Add(Me.dgClassroom)
        Me.GroupBox1.Controls.Add(Me.cmbAddress)
        Me.GroupBox1.Controls.Add(Me.cmbCapacity)
        Me.GroupBox1.Controls.Add(Me.lblCollege)
        Me.GroupBox1.Controls.Add(Me.lblStudent)
        Me.GroupBox1.Dock = System.Windows.Forms.DockStyle.Fill
        Me.GroupBox1.Location = New System.Drawing.Point(0, 48)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(416, 314)
        Me.GroupBox1.TabIndex = 8
        Me.GroupBox1.TabStop = False
        '
        'dgClassroom
        '
        Me.dgClassroom.CaptionText = "教室列表"
        Me.dgClassroom.DataMember = ""
        Me.dgClassroom.HeaderForeColor = System.Drawing.SystemColors.ControlText
        Me.dgClassroom.Location = New System.Drawing.Point(8, 64)
        Me.dgClassroom.Name = "dgClassroom"
        Me.dgClassroom.ReadOnly = True
        Me.dgClassroom.Size = New System.Drawing.Size(400, 240)
        Me.dgClassroom.TabIndex = 8
        Me.dgClassroom.TableStyles.AddRange(New System.Windows.Forms.DataGridTableStyle() {Me.DataGridTableStyle1})
        '
        'DataGridTableStyle1
        '
        Me.DataGridTableStyle1.DataGrid = Me.dgClassroom
        Me.DataGridTableStyle1.GridColumnStyles.AddRange(New System.Windows.Forms.DataGridColumnStyle() {Me.dgcAddress, Me.dgcCapacity})
        Me.DataGridTableStyle1.HeaderForeColor = System.Drawing.SystemColors.ControlText
        Me.DataGridTableStyle1.MappingName = ""
        '
        'dgcAddress
        '
        Me.dgcAddress.Format = ""
        Me.dgcAddress.FormatInfo = Nothing
        Me.dgcAddress.HeaderText = "教室"
        Me.dgcAddress.MappingName = ""
        Me.dgcAddress.Width = 75
        '
        'dgcCapacity
        '
        Me.dgcCapacity.Format = ""
        Me.dgcCapacity.FormatInfo = Nothing
        Me.dgcCapacity.HeaderText = "容纳人数"
        Me.dgcCapacity.MappingName = ""
        Me.dgcCapacity.Width = 75
        '
        'cmbAddress
        '
        Me.cmbAddress.Location = New System.Drawing.Point(40, 24)
        Me.cmbAddress.Name = "cmbAddress"
        Me.cmbAddress.Size = New System.Drawing.Size(152, 20)
        Me.cmbAddress.TabIndex = 7
        Me.cmbAddress.Text = "选择或输入教室地点"
        '
        'cmbCapacity
        '
        Me.cmbCapacity.Items.AddRange(New Object() {"20", "30", "40", "50", "60", "70"})
        Me.cmbCapacity.Location = New System.Drawing.Point(256, 24)
        Me.cmbCapacity.Name = "cmbCapacity"
        Me.cmbCapacity.Size = New System.Drawing.Size(152, 20)
        Me.cmbCapacity.TabIndex = 4
        Me.cmbCapacity.Text = "选择或输入容纳人数"
        '
        'lblCollege
        '
        Me.lblCollege.AutoSize = True
        Me.lblCollege.Location = New System.Drawing.Point(200, 32)
        Me.lblCollege.Name = "lblCollege"
        Me.lblCollege.Size = New System.Drawing.Size(54, 17)
        Me.lblCollege.TabIndex = 1
        Me.lblCollege.Text = "容纳人数"
        '
        'lblStudent
        '
        Me.lblStudent.AutoSize = True
        Me.lblStudent.Location = New System.Drawing.Point(8, 32)
        Me.lblStudent.Name = "lblStudent"
        Me.lblStudent.Size = New System.Drawing.Size(29, 17)
        Me.lblStudent.TabIndex = 0
        Me.lblStudent.Text = "地点"
        '
        'FormClassroom
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(416, 421)
        Me.Controls.Add(Me.GroupBox1)
        Me.Controls.Add(Me.Splitter1)
        Me.Controls.Add(Me.GroupBox2)
        Me.Controls.Add(Me.pnlTop)
        Me.Name = "FormClassroom"
        Me.Text = "FormClassroom"
        Me.pnlTop.ResumeLayout(False)
        Me.GroupBox2.ResumeLayout(False)
        Me.GroupBox1.ResumeLayout(False)
        CType(Me.dgClassroom, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub FormClassroom_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        '初始化教室下拉框
        cmbAddress.Items.Clear()
        cmbAddress.DisplayMember = "address"
        cmbAddress.ValueMember = "address"
        Dim dtClassroom As DataTable = DbBase.DataInterface.Execute4DS("select address,capacity from classroom").Tables(0)
        cmbAddress.DataSource = dtClassroom.DefaultView

        DataGridTableStyle1.MappingName = dtClassroom.TableName
        dgcAddress.MappingName = "address"
        dgcCapacity.MappingName = "capacity"
        dgClassroom.DataSource = dtClassroom.DefaultView
    End Sub

    Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
        Me.Close()
    End Sub

    Private Sub cmbAddress_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbAddress.SelectedIndexChanged
        Me.m_oClassroom = New Classroom(cmbAddress.SelectedValue)
        cmbCapacity.Text = Me.m_oClassroom.m_iCapacity
    End Sub

    Private Sub btnOk_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnOk.Click
        Me.m_oClassroom = New Classroom
        Me.m_oClassroom.m_sAddress = cmbAddress.Text
        Me.m_oClassroom.m_iCapacity = cmbCapacity.Text
        If Me.m_oClassroom.Update() = 0 Then
            MessageBox.Show("教师更新成功!")
        End If
        Dim dtClassroom As DataTable = DbBase.DataInterface.Execute4DS("select address,capacity from classroom").Tables(0)
        cmbAddress.DataSource = Nothing
        cmbAddress.Items.Clear()
        cmbAddress.DisplayMember = "address"
        cmbAddress.DataSource = dtClassroom.DefaultView
        dgClassroom.DataSource = dtClassroom.DefaultView
    End Sub

    Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        Dim dtClassroom As DataTable = DbBase.DataInterface.Execute4DS("select address,capacity from classroom").Tables(0)
        cmbAddress.DataSource = Nothing
        'cmbAddress.Items.Clear()
        cmbAddress.DisplayMember = "address"
        cmbAddress.ValueMember = "address"
        cmbAddress.DataSource = dtClassroom.DefaultView
        dgClassroom.DataSource = dtClassroom.DefaultView
    End Sub
End Class

⌨️ 快捷键说明

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