?? frmscore.vb
字號:
Public Class frmScore
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 GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents Label5 As System.Windows.Forms.Label
Friend WithEvents GroupBox3 As System.Windows.Forms.GroupBox
Friend WithEvents btnClear As System.Windows.Forms.Button
Friend WithEvents dgdList As System.Windows.Forms.DataGrid
Friend WithEvents Label6 As System.Windows.Forms.Label
Friend WithEvents txbPY As System.Windows.Forms.TextBox
Friend WithEvents txbName As System.Windows.Forms.TextBox
Friend WithEvents txbId As System.Windows.Forms.TextBox
Friend WithEvents btnSearch As System.Windows.Forms.Button
Friend WithEvents btnSubmit As System.Windows.Forms.Button
Friend WithEvents txbScore As System.Windows.Forms.TextBox
Friend WithEvents btnUpdate As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmScore))
Me.GroupBox1 = New System.Windows.Forms.GroupBox
Me.Label1 = New System.Windows.Forms.Label
Me.btnClear = New System.Windows.Forms.Button
Me.GroupBox2 = New System.Windows.Forms.GroupBox
Me.btnSubmit = New System.Windows.Forms.Button
Me.btnSearch = New System.Windows.Forms.Button
Me.txbId = New System.Windows.Forms.TextBox
Me.txbName = New System.Windows.Forms.TextBox
Me.Label5 = New System.Windows.Forms.Label
Me.Label4 = New System.Windows.Forms.Label
Me.Label3 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.txbPY = New System.Windows.Forms.TextBox
Me.GroupBox3 = New System.Windows.Forms.GroupBox
Me.btnUpdate = New System.Windows.Forms.Button
Me.Label6 = New System.Windows.Forms.Label
Me.txbScore = New System.Windows.Forms.TextBox
Me.dgdList = New System.Windows.Forms.DataGrid
Me.GroupBox1.SuspendLayout()
Me.GroupBox2.SuspendLayout()
Me.GroupBox3.SuspendLayout()
CType(Me.dgdList, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.Label1)
Me.GroupBox1.Controls.Add(Me.btnClear)
Me.GroupBox1.Dock = System.Windows.Forms.DockStyle.Top
Me.GroupBox1.Location = New System.Drawing.Point(0, 0)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(664, 88)
Me.GroupBox1.TabIndex = 0
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "結束選課,生成空成績單"
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(200, 8)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(360, 72)
Me.Label1.TabIndex = 1
Me.Label1.Text = "應該單獨有一個終止選課的功能,終止選課后生成空的成績單,所有學生將不允許更改課程信息,如果需要更改,必須單獨申請,特殊處理。終止選課一學年應該只能進行一次操作。讀" & _
"者需要注意實例沒有制作開始選課等功能,終止選課后在學生選課中仍然可以更改選擇的課程。"
'
'btnClear
'
Me.btnClear.Location = New System.Drawing.Point(8, 32)
Me.btnClear.Name = "btnClear"
Me.btnClear.Size = New System.Drawing.Size(152, 23)
Me.btnClear.TabIndex = 0
Me.btnClear.Text = "終止選課,生成空成績單"
'
'GroupBox2
'
Me.GroupBox2.Controls.Add(Me.btnSubmit)
Me.GroupBox2.Controls.Add(Me.btnSearch)
Me.GroupBox2.Controls.Add(Me.txbId)
Me.GroupBox2.Controls.Add(Me.txbName)
Me.GroupBox2.Controls.Add(Me.Label5)
Me.GroupBox2.Controls.Add(Me.Label4)
Me.GroupBox2.Controls.Add(Me.Label3)
Me.GroupBox2.Controls.Add(Me.Label2)
Me.GroupBox2.Controls.Add(Me.txbPY)
Me.GroupBox2.Dock = System.Windows.Forms.DockStyle.Top
Me.GroupBox2.Location = New System.Drawing.Point(0, 88)
Me.GroupBox2.Name = "GroupBox2"
Me.GroupBox2.Size = New System.Drawing.Size(664, 88)
Me.GroupBox2.TabIndex = 1
Me.GroupBox2.TabStop = False
Me.GroupBox2.Text = "選擇課程"
'
'btnSubmit
'
Me.btnSubmit.Location = New System.Drawing.Point(208, 48)
Me.btnSubmit.Name = "btnSubmit"
Me.btnSubmit.Size = New System.Drawing.Size(64, 23)
Me.btnSubmit.TabIndex = 8
Me.btnSubmit.Text = "最終提交"
'
'btnSearch
'
Me.btnSearch.Location = New System.Drawing.Point(144, 48)
Me.btnSearch.Name = "btnSearch"
Me.btnSearch.Size = New System.Drawing.Size(56, 23)
Me.btnSearch.TabIndex = 7
Me.btnSearch.Text = "查詢"
'
'txbId
'
Me.txbId.Location = New System.Drawing.Point(64, 50)
Me.txbId.Name = "txbId"
Me.txbId.Size = New System.Drawing.Size(64, 21)
Me.txbId.TabIndex = 6
Me.txbId.Text = ""
'
'txbName
'
Me.txbName.Location = New System.Drawing.Point(201, 19)
Me.txbName.Name = "txbName"
Me.txbName.Size = New System.Drawing.Size(64, 21)
Me.txbName.TabIndex = 5
Me.txbName.Text = ""
'
'Label5
'
Me.Label5.Location = New System.Drawing.Point(144, 24)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(56, 16)
Me.Label5.TabIndex = 3
Me.Label5.Text = "課程名稱"
'
'Label4
'
Me.Label4.Location = New System.Drawing.Point(8, 56)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(56, 16)
Me.Label4.TabIndex = 2
Me.Label4.Text = "課程編號"
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(8, 24)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(56, 16)
Me.Label3.TabIndex = 1
Me.Label3.Text = "課程拼音"
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(288, 16)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(368, 64)
Me.Label2.TabIndex = 0
Me.Label2.Text = "這里選擇一門課程,查詢出該課程所有的學生,并輸入成績。實際應用時不用選擇課程,而是根據登陸系統的的老師的編號,自動列出該老師所有課程,老師只能對自己的課程進行成績" & _
"的輸入的操作;最終提交是老師提交的成績,提交后的成績將不可以修改。"
'
'txbPY
'
Me.txbPY.Location = New System.Drawing.Point(64, 19)
Me.txbPY.Name = "txbPY"
Me.txbPY.Size = New System.Drawing.Size(64, 21)
Me.txbPY.TabIndex = 4
Me.txbPY.Text = ""
'
'GroupBox3
'
Me.GroupBox3.Controls.Add(Me.btnUpdate)
Me.GroupBox3.Controls.Add(Me.Label6)
Me.GroupBox3.Controls.Add(Me.txbScore)
Me.GroupBox3.Controls.Add(Me.dgdList)
Me.GroupBox3.Dock = System.Windows.Forms.DockStyle.Fill
Me.GroupBox3.Location = New System.Drawing.Point(0, 176)
Me.GroupBox3.Name = "GroupBox3"
Me.GroupBox3.Size = New System.Drawing.Size(664, 149)
Me.GroupBox3.TabIndex = 2
Me.GroupBox3.TabStop = False
Me.GroupBox3.Text = "課程成績輸入"
'
'btnUpdate
'
Me.btnUpdate.Location = New System.Drawing.Point(568, 80)
Me.btnUpdate.Name = "btnUpdate"
Me.btnUpdate.Size = New System.Drawing.Size(64, 23)
Me.btnUpdate.TabIndex = 8
Me.btnUpdate.Text = "修改成績"
'
'Label6
'
Me.Label6.Location = New System.Drawing.Point(536, 45)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(32, 16)
Me.Label6.TabIndex = 5
Me.Label6.Text = "成績"
'
'txbScore
'
Me.txbScore.Location = New System.Drawing.Point(568, 40)
Me.txbScore.Name = "txbScore"
Me.txbScore.Size = New System.Drawing.Size(64, 21)
Me.txbScore.TabIndex = 6
Me.txbScore.Text = ""
'
'dgdList
'
Me.dgdList.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.dgdList.CaptionVisible = False
Me.dgdList.DataMember = ""
Me.dgdList.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.dgdList.Location = New System.Drawing.Point(8, 16)
Me.dgdList.Name = "dgdList"
Me.dgdList.Size = New System.Drawing.Size(520, 128)
Me.dgdList.TabIndex = 0
'
'frmScore
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(664, 325)
Me.Controls.Add(Me.GroupBox3)
Me.Controls.Add(Me.GroupBox2)
Me.Controls.Add(Me.GroupBox1)
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Name = "frmScore"
Me.Text = "成績輸入"
Me.GroupBox1.ResumeLayout(False)
Me.GroupBox2.ResumeLayout(False)
Me.GroupBox3.ResumeLayout(False)
CType(Me.dgdList, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub btnClear_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnClear.Click
Dim db As DataBase = New DataBase
db.RunDelOrInsSQL("exec sf_終止選課")
db.Dispose()
End Sub
Private Sub SetDGDList()
Dim strSQL As String = "select b.課程名稱,a.學號,c.姓名,a.成績,"
strSQL += " a.編號,a.課程編號 from 成績表 as a, 課程信息 as b, "
strSQL += "學生信息 as c where a.課程編號=b.課程編號 and a.學號"
strSQL += "=c.學號 and 是否已確定成績 = 'N' "
Dim strFilter As String = ""
If Me.txbPY.Text.Trim.Length <> 0 Then
strFilter += " and 拼音碼 like '" + txbPY.Text.Trim + "%'"
End If
If Me.txbName.Text.Trim.Length <> 0 Then
strFilter += " and a.學號 like '" + txbId.Text.Trim + "%'"
End If
If Me.txbName.Text.Trim.Length <> 0 Then
strFilter += " and c.姓名 like '" + txbName.Text + "%'"
End If
If strFilter.Trim.Length = 0 Then
Exit Sub
Else
strFilter += " order by b.課程名稱,a.學號"
Dim db As DataBase = New DataBase
Dim dv As DataView = db.RunSelectSQL(strSQL + strFilter)
dv.AllowDelete = False
dv.AllowEdit = False
dv.AllowNew = False
dtData = dv.Table
Me.dgdList.DataSource = dv
Me.dgdList.AllowSorting = False
db.Dispose()
End If
End Sub
Private Sub txbId_KeyDown(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyEventArgs) Handles txbId.KeyDown
If e.KeyCode = Keys.Enter Then
SetDGDList()
End If
End Sub
Private Sub txbName_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txbName.KeyDown
If e.KeyCode = Keys.Enter Then
SetDGDList()
End If
End Sub
Private Sub txbPY_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txbPY.KeyDown
If e.KeyCode = Keys.Enter Then
SetDGDList()
End If
End Sub
Private Sub btnUpdate_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnUpdate.Click
Try
Dim score As Integer = CInt(txbScore.Text)
Catch ex As Exception
MessageBox.Show("成績格式不正確!")
End Try
If dgdList.CurrentCell.RowNumber <> -1 Then
Dim db As DataBase = New DataBase
Dim strSQL As String = "update 成績表 set 成績="
strSQL += txbScore.Text.Trim + " where 編號="
strSQL += dtData.Rows(dgdList. _
CurrentCell.RowNumber)(4).ToString.Trim
db.RunDelOrInsSQL(strSQL)
db.Dispose()
SetDGDList()
End If
End Sub
Private Sub btnSubmit_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnSubmit.Click
If dgdList.CurrentCell.RowNumber = -1 Then
Exit Sub
End If
Dim strSubject = dtData.Rows( _
dgdList.CurrentCell.RowNumber)(5).ToString.Trim
Dim dlgResult As DialogResult = MessageBox.Show _
("提交后成績不可以修改,是否確認提交?", _
"提示", MessageBoxButtons.YesNo)
If dlgResult = DialogResult.Yes Then
Dim strSQL As String = "exec sf_成績提交 " + strSubject
Dim db As DataBase = New DataBase
db.RunDelOrInsSQL(strSQL)
db.Dispose()
MessageBox.Show("提交成績成功!")
SetDGDList()
End If
End Sub
Private Sub btnSearch_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnSearch.Click
SetDGDList()
End Sub
End Class
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -