📄 frmstusel.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form FrmStuSel
BorderStyle = 1 'Fixed Single
ClientHeight = 3840
ClientLeft = 45
ClientTop = 345
ClientWidth = 5760
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3840
ScaleWidth = 5760
Begin VB.CommandButton Cmd_Cancel
BackColor = &H80000004&
Caption = "取 消"
Height = 400
Left = 3198
MouseIcon = "FrmStuSel.frx":0000
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 3
Top = 3240
Width = 1300
End
Begin VB.CommandButton Cmd_OK
BackColor = &H80000004&
Caption = "确 定"
Default = -1 'True
Height = 400
Left = 1263
MouseIcon = "FrmStuSel.frx":030A
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 2
Top = 3240
Width = 1300
End
Begin MSDataListLib.DataList DataList1
Bindings = "FrmStuSel.frx":0614
Height = 3000
Left = 3120
TabIndex = 0
Top = 120
Width = 2415
_ExtentX = 4260
_ExtentY = 5292
_Version = 393216
ListField = "Student_Name"
BoundColumn = "Student_Id"
End
Begin MSAdodcLib.Adodc AdoStuNameList
Height = 330
Left = -360
Top = 3000
Visible = 0 'False
Width = 2535
_ExtentX = 4471
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 1
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 = $"FrmStuSel.frx":064E
OLEDBString = $"FrmStuSel.frx":06D8
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = "sa"
Password = "sa"
RecordSource = "SELECT Student_Id,Student_Name FROM Students ORDER BY Student_Id"
Caption = "AdoStuNameList"
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 MSComctlLib.ImageList ImageList3
Left = 0
Top = 600
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483628
ImageWidth = 16
ImageHeight = 16
MaskColor = 16777215
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 5
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmStuSel.frx":0762
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmStuSel.frx":30F4
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmStuSel.frx":5A86
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmStuSel.frx":8418
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmStuSel.frx":ADAA
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.TreeView TreeView1
Height = 3015
Left = 120
TabIndex = 1
Top = 120
Width = 2895
_ExtentX = 5106
_ExtentY = 5318
_Version = 393217
HideSelection = 0 'False
LabelEdit = 1
Sorted = -1 'True
Style = 7
HotTracking = -1 'True
SingleSel = -1 'True
ImageList = "ImageList3"
BorderStyle = 1
Appearance = 1
MousePointer = 99
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
MouseIcon = "FrmStuSel.frx":D73C
End
End
Attribute VB_Name = "FrmStuSel"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Cmd_Cancel_Click()
Unload Me
End Sub
Private Sub Cmd_OK_Click()
'如果没有选择学生,则提示重新选择
If MyStu.Student_Id <= 0 Then
MsgBox "请选择学生"
Exit Sub
End If
'将选择学生的数据保存在SelStu变量中
SelStu.Student_Id = MyStu.Student_Id
SelStu.GetInfo (SelStu.Student_Id)
Unload Me
End Sub
Private Sub DataList1_Click()
'如果没有选择学生,则对MyStu对象初始化,然后返回
If DataList1.BoundText = "" Then
MyStu.Init
Exit Sub
End If
'读取当前学生信息到MyStu
MyStu.GetInfo (DataList1.BoundText)
End Sub
Private Sub Form_Load()
Dim TmpNode As Node
'设置根结点
Set TmpNode = TreeView1.Nodes.Add(, , "a0", "院系班级信息", 1, 3)
TmpNode.Selected = True
TmpNode.ExpandedImage = 2
'调用函数将所有院系班级添加到TreeView1中
Call Add_ClassToTree(TreeView1, "a0")
TreeView1_Click
End Sub
Private Sub TreeView1_Click()
Dim Focuskey As String
'根据关键字获取院系班级信息
Focuskey = TreeView1.SelectedItem.Key
CurClass.Class_Name = TreeView1.SelectedItem.Text
CurClass.Class_Id = Val(Right(TreeView1.SelectedItem.Key, Len(TreeView1.SelectedItem.Key) - 1))
If Focuskey = "a0" Then '根结点
AdoStuNameList.RecordSource = "SELECT * FROM Students WHERE Class_Id<0"
AdoStuNameList.Refresh
DataList1.ReFill
Exit Sub
End If
'如果包含子结点,则设置图像格式
If CurClass.HaveSon(CurClass.Class_Id) = False Then
TreeView1.SelectedItem.ExpandedImage = 4
TreeView1.SelectedItem.Image = 4
TreeView1.SelectedItem.SelectedImage = 5
End If
'读取CurClass中的所有院系班级信息
CurClass.GetInfo (CurClass.Class_Id)
'根据选择的院系班级编号刷新AdoStuNameList1,从而选择符合条件的学生姓名
AdoStuNameList.RecordSource = "SELECT Student_Id, Student_Name FROM Students WHERE Class_Id=" _
+ Trim(Str(CurClass.Class_Id))
AdoStuNameList.Refresh
DataList1.ReFill
DataList1_Click
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -