📄 frmclassschedule.vb
字号:
Imports System.Data.SqlClient
Imports System.IO
Public Class FrmCLassSchedule
Inherits System.Windows.Forms.Form
Private classID As String
Private classname As String
Private year As String
Private term As String
#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 TreeView1 As System.Windows.Forms.TreeView
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents LblClass As System.Windows.Forms.Label
Friend WithEvents CmbClass As System.Windows.Forms.ComboBox
Friend WithEvents LblTerm As System.Windows.Forms.Label
Friend WithEvents CmbTerm As System.Windows.Forms.ComboBox
Friend WithEvents LblYear As System.Windows.Forms.Label
Friend WithEvents CmbYear As System.Windows.Forms.ComboBox
Friend WithEvents BtnOutput As System.Windows.Forms.Button
Friend WithEvents LblTimePeriod As System.Windows.Forms.Label
Friend WithEvents LblDayOfWeek As System.Windows.Forms.Label
Friend WithEvents CmbDayOfWeek As System.Windows.Forms.ComboBox
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 LblCourse As System.Windows.Forms.Label
Friend WithEvents CmbCourse As System.Windows.Forms.ComboBox
Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
Friend WithEvents BtnOK As System.Windows.Forms.Button
Friend WithEvents CmbTimePeriod As System.Windows.Forms.ComboBox
Friend WithEvents LblID As System.Windows.Forms.Label
Friend WithEvents TxtID As System.Windows.Forms.TextBox
Friend WithEvents BtnRechoose As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.TreeView1 = New System.Windows.Forms.TreeView
Me.GroupBox1 = New System.Windows.Forms.GroupBox
Me.BtnOK = New System.Windows.Forms.Button
Me.LblClass = New System.Windows.Forms.Label
Me.CmbClass = New System.Windows.Forms.ComboBox
Me.LblTerm = New System.Windows.Forms.Label
Me.CmbTerm = New System.Windows.Forms.ComboBox
Me.LblYear = New System.Windows.Forms.Label
Me.CmbYear = New System.Windows.Forms.ComboBox
Me.GroupBox2 = New System.Windows.Forms.GroupBox
Me.TxtID = New System.Windows.Forms.TextBox
Me.LblID = New System.Windows.Forms.Label
Me.BtnOutput = New System.Windows.Forms.Button
Me.LblTimePeriod = New System.Windows.Forms.Label
Me.CmbTimePeriod = New System.Windows.Forms.ComboBox
Me.LblDayOfWeek = New System.Windows.Forms.Label
Me.CmbDayOfWeek = New System.Windows.Forms.ComboBox
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.LblCourse = New System.Windows.Forms.Label
Me.CmbCourse = New System.Windows.Forms.ComboBox
Me.BtnRechoose = New System.Windows.Forms.Button
Me.GroupBox1.SuspendLayout()
Me.GroupBox2.SuspendLayout()
Me.SuspendLayout()
'
'TreeView1
'
Me.TreeView1.ImageIndex = -1
Me.TreeView1.Location = New System.Drawing.Point(8, 8)
Me.TreeView1.Name = "TreeView1"
Me.TreeView1.SelectedImageIndex = -1
Me.TreeView1.Size = New System.Drawing.Size(376, 344)
Me.TreeView1.TabIndex = 4
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.BtnOK)
Me.GroupBox1.Controls.Add(Me.LblClass)
Me.GroupBox1.Controls.Add(Me.CmbClass)
Me.GroupBox1.Controls.Add(Me.LblTerm)
Me.GroupBox1.Controls.Add(Me.CmbTerm)
Me.GroupBox1.Controls.Add(Me.LblYear)
Me.GroupBox1.Controls.Add(Me.CmbYear)
Me.GroupBox1.Location = New System.Drawing.Point(392, 8)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(272, 104)
Me.GroupBox1.TabIndex = 5
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "请选择要编制课表的班级及学期:"
'
'BtnOK
'
Me.BtnOK.Location = New System.Drawing.Point(240, 32)
Me.BtnOK.Name = "BtnOK"
Me.BtnOK.Size = New System.Drawing.Size(24, 56)
Me.BtnOK.TabIndex = 16
Me.BtnOK.Text = "确定"
'
'LblClass
'
Me.LblClass.Location = New System.Drawing.Point(8, 24)
Me.LblClass.Name = "LblClass"
Me.LblClass.Size = New System.Drawing.Size(80, 15)
Me.LblClass.TabIndex = 15
Me.LblClass.Text = "请选择班级:"
'
'CmbClass
'
Me.CmbClass.Location = New System.Drawing.Point(88, 24)
Me.CmbClass.Name = "CmbClass"
Me.CmbClass.Size = New System.Drawing.Size(144, 20)
Me.CmbClass.TabIndex = 14
'
'LblTerm
'
Me.LblTerm.Location = New System.Drawing.Point(8, 72)
Me.LblTerm.Name = "LblTerm"
Me.LblTerm.Size = New System.Drawing.Size(80, 15)
Me.LblTerm.TabIndex = 5
Me.LblTerm.Text = "请选择学期:"
'
'CmbTerm
'
Me.CmbTerm.Location = New System.Drawing.Point(88, 72)
Me.CmbTerm.Name = "CmbTerm"
Me.CmbTerm.Size = New System.Drawing.Size(144, 20)
Me.CmbTerm.TabIndex = 4
'
'LblYear
'
Me.LblYear.Location = New System.Drawing.Point(8, 48)
Me.LblYear.Name = "LblYear"
Me.LblYear.Size = New System.Drawing.Size(80, 15)
Me.LblYear.TabIndex = 3
Me.LblYear.Text = "请选择年份:"
'
'CmbYear
'
Me.CmbYear.Location = New System.Drawing.Point(88, 48)
Me.CmbYear.Name = "CmbYear"
Me.CmbYear.Size = New System.Drawing.Size(144, 20)
Me.CmbYear.TabIndex = 2
'
'GroupBox2
'
Me.GroupBox2.Controls.Add(Me.BtnRechoose)
Me.GroupBox2.Controls.Add(Me.TxtID)
Me.GroupBox2.Controls.Add(Me.LblID)
Me.GroupBox2.Controls.Add(Me.BtnOutput)
Me.GroupBox2.Controls.Add(Me.LblTimePeriod)
Me.GroupBox2.Controls.Add(Me.CmbTimePeriod)
Me.GroupBox2.Controls.Add(Me.LblDayOfWeek)
Me.GroupBox2.Controls.Add(Me.CmbDayOfWeek)
Me.GroupBox2.Controls.Add(Me.BtnExit)
Me.GroupBox2.Controls.Add(Me.BtnDel)
Me.GroupBox2.Controls.Add(Me.BtnEdit)
Me.GroupBox2.Controls.Add(Me.BtnAdd)
Me.GroupBox2.Controls.Add(Me.LblCourse)
Me.GroupBox2.Controls.Add(Me.CmbCourse)
Me.GroupBox2.Location = New System.Drawing.Point(392, 128)
Me.GroupBox2.Name = "GroupBox2"
Me.GroupBox2.Size = New System.Drawing.Size(272, 224)
Me.GroupBox2.TabIndex = 6
Me.GroupBox2.TabStop = False
Me.GroupBox2.Text = "请设置课表:"
'
'TxtID
'
Me.TxtID.Location = New System.Drawing.Point(112, 24)
Me.TxtID.Name = "TxtID"
Me.TxtID.Size = New System.Drawing.Size(144, 21)
Me.TxtID.TabIndex = 34
Me.TxtID.Text = ""
'
'LblID
'
Me.LblID.Location = New System.Drawing.Point(8, 24)
Me.LblID.Name = "LblID"
Me.LblID.Size = New System.Drawing.Size(96, 15)
Me.LblID.TabIndex = 33
Me.LblID.Text = " 请选择编号:"
'
'BtnOutput
'
Me.BtnOutput.Location = New System.Drawing.Point(144, 160)
Me.BtnOutput.Name = "BtnOutput"
Me.BtnOutput.Size = New System.Drawing.Size(88, 24)
Me.BtnOutput.TabIndex = 31
Me.BtnOutput.Text = "导出课表"
'
'LblTimePeriod
'
Me.LblTimePeriod.Location = New System.Drawing.Point(8, 72)
Me.LblTimePeriod.Name = "LblTimePeriod"
Me.LblTimePeriod.Size = New System.Drawing.Size(96, 15)
Me.LblTimePeriod.TabIndex = 30
Me.LblTimePeriod.Text = "请选择时间段:"
'
'CmbTimePeriod
'
Me.CmbTimePeriod.Location = New System.Drawing.Point(112, 72)
Me.CmbTimePeriod.Name = "CmbTimePeriod"
Me.CmbTimePeriod.Size = New System.Drawing.Size(144, 20)
Me.CmbTimePeriod.TabIndex = 29
'
'LblDayOfWeek
'
Me.LblDayOfWeek.Location = New System.Drawing.Point(8, 48)
Me.LblDayOfWeek.Name = "LblDayOfWeek"
Me.LblDayOfWeek.Size = New System.Drawing.Size(96, 15)
Me.LblDayOfWeek.TabIndex = 28
Me.LblDayOfWeek.Text = "请选择星期几:"
'
'CmbDayOfWeek
'
Me.CmbDayOfWeek.Location = New System.Drawing.Point(112, 48)
Me.CmbDayOfWeek.Name = "CmbDayOfWeek"
Me.CmbDayOfWeek.Size = New System.Drawing.Size(144, 20)
Me.CmbDayOfWeek.TabIndex = 27
'
'BtnExit
'
Me.BtnExit.Location = New System.Drawing.Point(144, 192)
Me.BtnExit.Name = "BtnExit"
Me.BtnExit.Size = New System.Drawing.Size(88, 24)
Me.BtnExit.TabIndex = 26
Me.BtnExit.Text = "退出"
'
'BtnDel
'
Me.BtnDel.Location = New System.Drawing.Point(24, 160)
Me.BtnDel.Name = "BtnDel"
Me.BtnDel.Size = New System.Drawing.Size(88, 24)
Me.BtnDel.TabIndex = 25
Me.BtnDel.Text = "删除记录"
'
'BtnEdit
'
Me.BtnEdit.Location = New System.Drawing.Point(144, 128)
Me.BtnEdit.Name = "BtnEdit"
Me.BtnEdit.Size = New System.Drawing.Size(88, 24)
Me.BtnEdit.TabIndex = 24
Me.BtnEdit.Text = "修改记录"
'
'BtnAdd
'
Me.BtnAdd.Location = New System.Drawing.Point(24, 128)
Me.BtnAdd.Name = "BtnAdd"
Me.BtnAdd.Size = New System.Drawing.Size(88, 24)
Me.BtnAdd.TabIndex = 23
Me.BtnAdd.Text = "添加记录"
'
'LblCourse
'
Me.LblCourse.Location = New System.Drawing.Point(8, 96)
Me.LblCourse.Name = "LblCourse"
Me.LblCourse.Size = New System.Drawing.Size(96, 15)
Me.LblCourse.TabIndex = 22
Me.LblCourse.Text = " 请选择课程:"
'
'CmbCourse
'
Me.CmbCourse.Location = New System.Drawing.Point(112, 96)
Me.CmbCourse.Name = "CmbCourse"
Me.CmbCourse.Size = New System.Drawing.Size(144, 20)
Me.CmbCourse.TabIndex = 21
'
'BtnRechoose
'
Me.BtnRechoose.Location = New System.Drawing.Point(24, 192)
Me.BtnRechoose.Name = "BtnRechoose"
Me.BtnRechoose.Size = New System.Drawing.Size(88, 24)
Me.BtnRechoose.TabIndex = 35
Me.BtnRechoose.Text = "重新选择班级"
'
'FrmCLassSchedule
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(672, 366)
Me.Controls.Add(Me.GroupBox2)
Me.Controls.Add(Me.TreeView1)
Me.Controls.Add(Me.GroupBox1)
Me.Name = "FrmCLassSchedule"
Me.Text = "课表设置"
Me.GroupBox1.ResumeLayout(False)
Me.GroupBox2.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub FrmCLassSchedule_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
addCmbClass()
addCmbYear(2000, 2010)
addCmbTerm()
addCmbDayOfWeek()
addCmbTimePeriod()
addCmbCourse()
Button_Enable(False)
End Sub
Private Sub addCmbClass()
Dim str1 As String
Dim str2 As String
Dim str3 As String
Dim str4 As String
Try
Dim sql As String = "SELECT A.CLASSID, A.CLASSYEAR,B.DEPARTMENT,A.CLASSNUMBER FROM CLASSINFO A,DEPARTMENTINFO B WHERE A.DEPARTMENTID=B.DEPARTMENTID"
Dim dt As DataTable = GetDataTable(sql)
For i As Integer = 0 To dt.Rows.Count - 1
str1 = dt.Rows(i)("classyear")
str2 = dt.Rows(i)("department")
str3 = dt.Rows(i)("classnumber")
str4 = dt.Rows(i)("classid")
Me.CmbClass.Items.Add(str4 + "|" + str1 + "级" + str2 + str3)
Next
Catch ex As Exception
WriteErr(ex)
End Try
End Sub
Private Sub addCmbYear(ByVal year1 As Int16, ByVal year2 As Int16)
For i As Integer = year1 To year2
Me.CmbYear.Items.Add(i)
Next
End Sub
Private Sub addCmbTerm()
Me.CmbTerm.Items.Add("上学期")
Me.CmbTerm.Items.Add("下学期")
End Sub
Private Sub addCmbDayOfWeek()
Me.CmbDayOfWeek.Items.Add("星期一")
Me.CmbDayOfWeek.Items.Add("星期二")
Me.CmbDayOfWeek.Items.Add("星期三")
Me.CmbDayOfWeek.Items.Add("星期四")
Me.CmbDayOfWeek.Items.Add("星期五")
Me.CmbDayOfWeek.Items.Add("星期六")
Me.CmbDayOfWeek.Items.Add("星期日")
End Sub
Private Sub addCmbTimePeriod()
Me.CmbTimePeriod.Items.Add("06:00-08:00")
Me.CmbTimePeriod.Items.Add("08:00-10:00")
Me.CmbTimePeriod.Items.Add("10:00-12:00")
Me.CmbTimePeriod.Items.Add("12:00-14:00")
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -