📄 frmxgkc.frm
字号:
TabIndex = 5
Top = 2280
Width = 1575
End
Begin VB.TextBox Text1
Height = 375
Left = -71880
TabIndex = 3
Top = 1080
Width = 2415
End
Begin VB.ListBox List1
Height = 3840
ItemData = "Frmxgkc.frx":0040
Left = -74760
List = "Frmxgkc.frx":0042
TabIndex = 1
Top = 720
Width = 2415
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "待选课程:"
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 3480
TabIndex = 17
Top = 1080
Width = 1500
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "本班已有课程:"
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 120
TabIndex = 15
Top = 1080
Width = 2100
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "选择班级"
Height = 180
Left = 2280
TabIndex = 12
Top = 480
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "选择专业"
Height = 180
Left = 360
TabIndex = 10
Top = 480
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "已有课程名称:"
BeginProperty Font
Name = "华文行楷"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = -74760
TabIndex = 4
Top = 360
Width = 1800
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "新课程名称:"
BeginProperty Font
Name = "华文行楷"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = -71880
TabIndex = 2
Top = 720
Width = 1605
End
End
End
Attribute VB_Name = "Frmxgkc"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Combo1_Click()
Dim a As String
Dim b As String
Combo2.Clear
Combo2.Text = "请选择"
Adodc2.RecordSource = "select * from 班级 where 专业名称='" & Trim(Combo1.Text) & "' order by 班级名称"
Adodc2.Refresh
If Adodc2.Recordset.RecordCount > 0 Then
With Adodc2.Recordset
.MoveFirst
b = ""
Do While Not .EOF
a = .Fields(0)
If a <> b Then
Combo2.AddItem .Fields(0)
End If
b = a
.MoveNext
Loop
End With
End If
End Sub
Private Sub Combo2_Click()
List2.Clear
Call list(List2)
End Sub
Private Sub Command1_Click()
If Text1.Text = "" Then
MsgBox "请输入你要添加的课程", vbOKOnly, "提示"
Exit Sub
End If
Adodc1.RecordSource = "select * from 课程"
Adodc1.Refresh
With Adodc1.Recordset
.AddNew
.Fields(0) = Text1.Text
.Update
End With
Text1.Text = ""
MsgBox "添加课程成功", vbOKOnly, "提示"
List1.Clear
Call Addlist(List1)
List1.Refresh
End Sub
Private Sub Command3_Click()
Dim del As String
del = MsgBox("删除该课程将会删除课程表中所有班级的该课程" & vbCr & "你确定删除课程“" & List1.Text & "”", vbYesNo + vbQuestion + vbDefaultButton2, "询问")
If del = vbYes Then
Adodc1.RecordSource = "select * from 课程 where 课程名称='" & Trim(List1.Text) & "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
With Adodc1.Recordset
.Delete
.Update
End With
End If
List1.Clear
Call Addlist(List1)
End If
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Command5_Click()
If Combo1.Text = "请选择" Then
MsgBox "请选择专业", vbOKOnly, "提示"
Exit Sub
ElseIf Combo2.Text = "请选择" Then
MsgBox "请选择班级", vbOKOnly, "提示"
Exit Sub
End If
If List3.Text = "" Then
MsgBox "你还没有选择课程", vbOKOnly, "提示"
Exit Sub
End If
Adodc3.RecordSource = "select * from 各班课程 where 班级名称='" & Trim(Combo2.Text) & "' AND 课程名称='" & Trim(List3.Text) & "' "
Adodc3.Refresh
If Adodc3.Recordset.RecordCount = 0 Then
List2.Clear
With Adodc3.Recordset
List2.AddItem List3.Text
.AddNew
.Fields(0) = List3.Text
.Fields(1) = Trim(Combo2.Text)
.Update
End With
Else
MsgBox "该班级已经有你所选的课程了,不需要重复添加", vbOKOnly, "提示"
List2.Clear
End If
Call list(List2)
End Sub
Private Sub Command6_Click()
Unload Me
End Sub
Private Sub Command7_Click()
If Combo1.Text = "请选择" Then
MsgBox "请选择专业", vbOKOnly, "提示"
Exit Sub
ElseIf Combo2.Text = "请选择" Then
MsgBox "请选择班级", vbOKOnly, "提示"
Exit Sub
End If
If List2.Text = "" Then
MsgBox "你还没有选择课程", vbOKOnly, "提示"
Exit Sub
End If
Adodc3.RecordSource = "select * from 各班课程 where 班级名称='" & Trim(Combo2.Text) & "' AND 课程名称='" & Trim(List2.Text) & "' "
Adodc3.Refresh
If Adodc3.Recordset.RecordCount <> 0 Then
With Adodc3.Recordset
.Delete
.Update
End With
List2.RemoveItem List2.ListIndex
End If
End Sub
Private Sub Command8_Click()
If Combo1.Text = "请选择" Then
MsgBox "请选择专业", vbOKOnly, "提示"
Exit Sub
ElseIf Combo2.Text = "请选择" Then
MsgBox "请选择班级", vbOKOnly, "提示"
Exit Sub
End If
List2.Clear
Adodc3.RecordSource = "select * from 各班课程 where 班级名称='" & Trim(Combo2.Text) & "'"
Adodc3.Refresh
If Adodc3.Recordset.RecordCount <> 0 Then
Adodc3.Recordset.MoveFirst
Do While Not Adodc3.Recordset.EOF
Adodc3.Recordset.Delete
Adodc3.Recordset.MoveNext
Loop
End If
With Adodc3.Recordset
For i = 0 To List3.ListCount - 1
List2.AddItem List3.list(i)
.AddNew
.Fields(0) = List3.list(i)
.Fields(1) = Trim(Combo2.Text)
Next i
.UpdateBatch
End With
MsgBox "添加所有课程成功", vbOKOnly, "提示"
End Sub
Private Sub Command9_Click()
If Combo1.Text = "请选择" Then
MsgBox "请选择专业", vbOKOnly, "提示"
Exit Sub
ElseIf Combo2.Text = "请选择" Then
MsgBox "请选择班级", vbOKOnly, "提示"
Exit Sub
End If
List2.Clear
Adodc3.RecordSource = "select * from 各班课程 where 班级名称='" & Trim(Combo2.Text) & "'"
Adodc3.Refresh
If Adodc3.Recordset.RecordCount <> 0 Then
Adodc3.Recordset.MoveFirst
Do While Not Adodc3.Recordset.EOF
Adodc3.Recordset.Delete
Adodc3.Recordset.MoveNext
Loop
Adodc3.Recordset.UpdateBatch
MsgBox "删除全部课程成功", vbOKOnly, "提示"
End If
End Sub
Private Sub Form_Load()
SSTab1.Tab = 0
Dim a As String
Dim b As String
Call Addlist(List1)
Adodc2.RecordSource = "select * from 班级 order by 专业名称"
Adodc2.Refresh
If Adodc2.Recordset.RecordCount > 0 Then
With Adodc2.Recordset
.MoveFirst
b = ""
Do While Not .EOF
a = .Fields(1)
If a <> b Then
Combo1.AddItem .Fields(1)
End If
b = a
.MoveNext
Loop
End With
End If
End Sub
Private Sub Addlist(listX As ListBox)
Adodc1.RecordSource = "select * from 课程"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
With Adodc1.Recordset
.MoveFirst
Do While Not .EOF
listX.AddItem .Fields(0)
.MoveNext
Loop
End With
End If
End Sub
Private Sub list(listX As ListBox)
Adodc2.RecordSource = "select * from 各班课程 where 班级名称='" & Trim(Combo2.Text) & "' order by 班级名称 "
Adodc2.Refresh
If Adodc2.Recordset.RecordCount > 0 Then
With Adodc2.Recordset
.MoveFirst
Do While Not .EOF
listX.AddItem .Fields(0)
.MoveNext
Loop
End With
End If
End Sub
Private Sub SSTab1_Click(PreviousTab As Integer)
List3.Clear
Call Addlist(List3)
End Sub
Private Sub Form_Initialize()
ChDrive App.Path
ChDir App.Path
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -