📄 courseset.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form courset
Caption = "课程设置"
ClientHeight = 5625
ClientLeft = 60
ClientTop = 450
ClientWidth = 8550
LinkTopic = "Form4"
Picture = "courseset.frx":0000
ScaleHeight = 5625
ScaleWidth = 8550
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command4
Caption = "取消"
Height = 375
Left = 3480
Picture = "courseset.frx":8F86
Style = 1 'Graphical
TabIndex = 11
Top = 3840
Width = 1335
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 120
Top = 480
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.CommandButton Command3
Caption = "确定"
Height = 375
Left = 3480
Picture = "courseset.frx":B291
Style = 1 'Graphical
TabIndex = 10
Top = 3240
Width = 1335
End
Begin VB.CommandButton Command6
Caption = "返回"
Height = 375
Left = 3480
Picture = "courseset.frx":D59C
Style = 1 'Graphical
TabIndex = 9
Top = 4440
Width = 1335
End
Begin VB.ComboBox Combo1
Height = 300
Left = 2040
TabIndex = 7
Top = 240
Width = 1935
End
Begin VB.ListBox List2
Height = 3480
ItemData = "courseset.frx":F8A7
Left = 5160
List = "courseset.frx":F8A9
TabIndex = 3
Top = 1320
Width = 2655
End
Begin VB.CommandButton Command2
BackColor = &H00C0C0FF&
Caption = "<---"
Height = 375
Left = 3600
Style = 1 'Graphical
TabIndex = 2
Top = 2520
Width = 855
End
Begin VB.CommandButton Command1
BackColor = &H00C0C0FF&
Caption = "--->"
Height = 375
Left = 3600
Style = 1 'Graphical
TabIndex = 1
Top = 1800
Width = 855
End
Begin VB.ListBox List1
Height = 3480
ItemData = "courseset.frx":F8AB
Left = 480
List = "courseset.frx":F8AD
TabIndex = 0
Top = 1320
Width = 2655
End
Begin MSComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 375
Left = 0
TabIndex = 8
Top = 5250
Width = 8550
_ExtentX = 15081
_ExtentY = 661
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 4
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Style = 6
Alignment = 1
TextSave = "2004-12-20"
EndProperty
BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Style = 5
Alignment = 1
TextSave = "12:02"
EndProperty
BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Alignment = 1
Object.Width = 7038
MinWidth = 7038
Text = "学生管理系统"
TextSave = "学生管理系统"
EndProperty
BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Alignment = 1
EndProperty
EndProperty
End
Begin MSAdodcLib.Adodc Adodc2
Height = 330
Left = 0
Top = 0
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSAdodcLib.Adodc Adodc3
Height = 330
Left = 0
Top = 0
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = " 应选课程"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000040&
Height = 375
Left = 5400
TabIndex = 4
Top = 840
Width = 2295
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "选择专业"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 600
TabIndex = 6
Top = 240
Width = 1335
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = " 所有课程"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000040&
Height = 375
Left = 720
TabIndex = 5
Top = 840
Width = 2295
End
End
Attribute VB_Name = "courset"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Combo1_Click()
List2.Clear
End Sub
Private Sub Command1_Click()
List2.AddItem List1.List(List1.ListIndex)
End Sub
Private Sub Command2_Click()
List2.RemoveItem List2.ListIndex
End Sub
Private Sub Command3_Click()
Adodc3.RecordSource = "select * from Manage_class where major_name='" & Combo1.Text & "'"
Adodc3.Refresh
'delect exist data
If Adodc3.Recordset.RecordCount <> 0 Then
For k = 0 To Adodc3.Recordset.RecordCount - 1
Adodc3.Recordset.Delete
Adodc3.Recordset.MoveNext
Next k
End If
'add new data
For j = 0 To List2.ListCount - 1
Adodc3.Recordset.AddNew
Adodc3.Recordset.Fields("major_name") = Combo1.Text
Adodc3.Recordset.Fields("sub_name") = List2.List(j)
Adodc3.Recordset.Update
MsgBox ("设置成功!")
Next j
End Sub
Private Sub Command4_Click()
For i = 0 To List2.ListCount - 1
List2.Clear
Next i
End Sub
Private Sub Command6_Click()
Unload Me
End Sub
Private Sub Form_Load()
Adodc1.ConnectionString = cnn()
Adodc2.ConnectionString = cnn()
Adodc3.ConnectionString = cnn()
'bind list (the course must be demand)
Adodc1.RecordSource = "select sub_name from Manage_subject where sub_type='必修'"
Adodc1.Refresh
For i = 0 To Adodc1.Recordset.RecordCount - 1
List1.AddItem (Adodc1.Recordset.Fields("sub_name"))
Adodc1.Recordset.MoveNext
Next i
'bind major
Me.Adodc2.ConnectionString = cnn()
Adodc2.RecordSource = "select major_name from Manage_base"
Adodc2.Refresh
For i = 0 To Adodc2.Recordset.RecordCount - 1
a = Mid$(Adodc2.Recordset.Fields("major_name"), 1, InStr(2, Adodc2.Recordset.Fields("major_name"), "0") + 1)
'mid 从第一个开始 向后拿字符 instr找到第几个位置
If a = c Then
c = a
Adodc2.Recordset.MoveNext
Else
c = a
Me.Combo1.AddItem (a)
Adodc2.Recordset.MoveNext
End If
Next i
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -