📄 frmcoui.frm
字号:
VERSION 5.00
Object = "{E95A2510-F3D1-416D-823B-4F840FE98091}#3.0#0"; "Command.ocx"
Begin VB.Form frmcoui
BackColor = &H00E0E0E0&
BorderStyle = 1 'Fixed Single
Caption = "课程信息"
ClientHeight = 5580
ClientLeft = 1035
ClientTop = 135
ClientWidth = 8355
Icon = "frmcoui.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
ScaleHeight = 5580
ScaleWidth = 8355
Begin CSCommand.Command Command2
Height = 375
Left = 6720
TabIndex = 8
Top = 4680
Width = 1095
_ExtentX = 1931
_ExtentY = 661
IconAlign = 0
Icon = "frmcoui.frx":08CA
Caption = "删 除"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin CSCommand.Command Command1
Height = 375
Left = 6720
TabIndex = 7
Top = 3960
Width = 1095
_ExtentX = 1931
_ExtentY = 661
IconAlign = 0
Icon = "frmcoui.frx":08E6
Caption = "添 加"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.TextBox Text1
BackColor = &H8000000E&
Height = 1260
Index = 1
Left = 5640
Locked = -1 'True
MaxLength = 30
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 6
Top = 2040
Width = 1995
End
Begin VB.TextBox Text1
BackColor = &H8000000E&
Height = 300
Index = 0
Left = 5640
MaxLength = 10
TabIndex = 5
Top = 1200
Width = 1980
End
Begin VB.ComboBox Combo1
Height = 300
Left = 960
Style = 2 'Dropdown List
TabIndex = 3
Top = 360
Width = 1455
End
Begin VB.ListBox List2
Appearance = 0 'Flat
Height = 4530
Left = 3120
TabIndex = 1
Top = 720
Width = 2175
End
Begin VB.ListBox List1
Appearance = 0 'Flat
Height = 4530
Left = 240
TabIndex = 0
Top = 720
Width = 2175
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "备注"
Height = 255
Left = 5640
TabIndex = 14
Top = 1680
Width = 615
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "课程名"
Height = 255
Left = 5640
TabIndex = 13
Top = 840
Width = 615
End
Begin VB.Label Label3
Appearance = 0 'Flat
BackColor = &H00C0C0C0&
Caption = ">>>"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 255
Index = 3
Left = 2520
TabIndex = 12
Top = 3360
Width = 495
End
Begin VB.Label Label3
Appearance = 0 'Flat
BackColor = &H00C0C0C0&
Caption = "> >"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 255
Index = 2
Left = 2520
TabIndex = 11
Top = 2880
Width = 495
End
Begin VB.Label Label3
Appearance = 0 'Flat
BackColor = &H00C0C0C0&
Caption = "<<<"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 255
Index = 1
Left = 2520
TabIndex = 10
Top = 2400
Width = 495
End
Begin VB.Label Label3
Appearance = 0 'Flat
BackColor = &H00C0C0C0&
Caption = "< <"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 255
Index = 0
Left = 2520
TabIndex = 9
Top = 1920
Width = 495
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "班号"
Height = 255
Left = 240
TabIndex = 4
Top = 360
Width = 735
End
Begin VB.Label Label1
Appearance = 0 'Flat
BackColor = &H80000005&
BackStyle = 0 'Transparent
BorderStyle = 1 'Fixed Single
Caption = " 课 程 列 表"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000D&
Height = 375
Left = 3120
TabIndex = 2
Top = 360
Width = 2175
End
Begin VB.Label Label7
Appearance = 0 'Flat
BackColor = &H80000005&
BackStyle = 0 'Transparent
BorderStyle = 1 'Fixed Single
ForeColor = &H80000008&
Height = 5175
Index = 1
Left = 3000
TabIndex = 16
Top = 240
Width = 2415
End
Begin VB.Label Label7
Appearance = 0 'Flat
BackColor = &H80000005&
BackStyle = 0 'Transparent
BorderStyle = 1 'Fixed Single
ForeColor = &H80000008&
Height = 5175
Index = 0
Left = 120
TabIndex = 15
Top = 240
Width = 2415
End
Begin VB.Label Label7
Appearance = 0 'Flat
BackColor = &H80000005&
BackStyle = 0 'Transparent
BorderStyle = 1 'Fixed Single
Caption = "此块位课程信息列表添加或删除内容"
ForeColor = &H00FFFFFF&
Height = 5175
Index = 2
Left = 5520
TabIndex = 17
Top = 240
Width = 2415
End
End
Attribute VB_Name = "frmcoui"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim mrc As ADODB.Recordset
Dim MsgText As String
Private Sub Combo1_Click()
List1Text
End Sub
Private Sub Command1_Click()
Dim txtSQL As String
If Text1(0) = "" Then
MsgBox " 课程名称不能为空!", vbOKOnly, "提示"
Text1(0).SetFocus
Exit Sub
End If
txtSQL = "select * from course_Form where course_Name='" & Trim(Text1(0)) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = False Then
MsgBox "此课程名称已经存在!", vbOKOnly, "警告"
Text1(0).SetFocus
Exit Sub
End If
mrc.Close
txtSQL = "select * from course_Form"
Set mrc = ExecuteSQL(txtSQL, MsgText)
mrc.AddNew
mrc.Fields(0) = Trim(Text1(0))
mrc.Fields(1) = Trim(Text1(1))
mrc.Update
mrc.Close
Text1(0) = ""
Text1(1) = ""
MsgBox "课程信息添加成功!", vbOKOnly, "提示"
List2Text
End Sub
Private Sub Command2_Click()
Dim txtSQL As String
If MsgBox("要删除课程记录?", vbYesNo + vbQuestion + vbDefaultButton2, "确认") = vbYes Then
If List2.Text <> "" Then
txtSQL = "delete from course_Form where course_Name='" & Trim(List2.Text) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
MsgBox "课程信息已经删除!", vbOKOnly, "提示"
List2Text
End If
End If
Exit Sub
End Sub
Private Sub Form_Load()
Dim txtSQL As String
Me.Caption = "课程信息->设 置"
txtSQL = "select * from class_Form"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = True Then
MsgBox "请先进行班级设置!", vbOKOnly, "提示"
Else
With Combo1
Do While Not mrc.EOF
.AddItem Trim(mrc!class_NO)
mrc.MoveNext
Loop
Combo1.ListIndex = 0
End With
End If
List2Text
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label3(0).BackColor = &HC0C0C0
Label3(1).BackColor = &HC0C0C0
Label3(2).BackColor = &HC0C0C0
Label3(3).BackColor = &HC0C0C0
End Sub
Private Sub Form_Resize()
dColor.ZOrder 1
End Sub
Private Sub Label3_Click(Index As Integer)
Dim txtSQL As String
Dim tSQL As String
Dim mmrc As ADODB.Recordset
If Index = 0 Then
If Combo1.Text <> "" And List2.Text <> "" Then
txtSQL = "delete from class_Cour where class_NO='" & Trim(Combo1.Text) & "' and course_Name='" & Trim(List2.Text) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
txtSQL = "select * from class_Cour"
Set mrc = ExecuteSQL(txtSQL, MsgText)
mrc.AddNew
mrc.Fields(0) = Trim(Combo1.Text)
mrc.Fields(1) = Trim(List2.Text)
mrc.Update
mrc.Close
End If
End If
If Index = 1 Then
If Combo1.Text <> "" Then
txtSQL = "delete from class_Cour where class_NO='" & Trim(Combo1.Text) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
tSQL = "select * from course_Form"
txtSQL = "select * from class_Cour"
Set mmrc = ExecuteSQL(tSQL, MsgText)
If mmrc.EOF = True Then
MsgBox "请先进行班级设置!", vbOKOnly, "提示"
Else
Do While Not mmrc.EOF
Set mrc = ExecuteSQL(txtSQL, MsgText)
mrc.AddNew
mrc.Fields(0) = Trim(Combo1.Text)
mrc.Fields(1) = mmrc.Fields(0)
mrc.Update
mrc.Close
mmrc.MoveNext
Loop
End If
End If
End If
If Index = 2 Then
If Combo1.Text <> "" And List1.Text <> "" Then
txtSQL = "delete from class_Cour where class_NO='" & Trim(Combo1.Text) & "' and course_Name='" & Trim(List1.Text) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
End If
End If
If Index = 3 Then
If Combo1.Text <> "" Then
txtSQL = "delete from class_Cour where class_NO='" & Trim(Combo1.Text) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
End If
End If
txtSQL = "select * from class_Cour"
Set mrc = ExecuteSQL(txtSQL, MsgText)
List1Text
End Sub
Private Sub Label3_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
Label3(Index).BackColor = &HFFFFFF
End Sub
Private Sub List2_Click()
Text1(0) = List2.Text
End Sub
Private Sub Text1_Change(Index As Integer)
Dim txSQL As String
If Index = 0 Then
txtSQL = "select * from course_Form where course_Name='" & Trim(Text1(0)) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = False Then
Text1(1) = mrc.Fields(1)
Text1(1).Locked = True
Else
Text1(1) = ""
Text1(1).Locked = False
End If
End If
End Sub
Private Sub Text1_GotFocus(Index As Integer)
Text1(Index).SelStart = 0
Text1(Index).SelLength = Len(Text1(Index))
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
EnterToTab KeyCode
End Sub
Private Sub List1Text()
Dim txSQL As String
Dim mrcc As ADODB.Recordset
txSQL = "select * from class_Cour where class_NO='" & Trim(Combo1.Text) & "'"
Set mrcc = ExecuteSQL(txSQL, MsgText)
List1.Clear
Do While Not mrcc.EOF
List1.AddItem Trim(mrcc!course_Name)
mrcc.MoveNext
Loop
mrcc.Close
End Sub
Private Sub List2Text()
Dim txSQL As String
Dim mrcc As ADODB.Recordset
txSQL = "select * from course_Form "
Set mrcc = ExecuteSQL(txSQL, MsgText)
List2.Clear
Do While Not mrcc.EOF
List2.AddItem Trim(mrcc!course_Name)
mrcc.MoveNext
Loop
mrcc.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -