frmxgxj.frm
来自「这是一个VB+ACCESS开发的学生信息管理系统,我是用了一个多月才弄出来的嘎,」· FRM 代码 · 共 859 行 · 第 1/2 页
FRM
859 行
EndProperty
BeginProperty Column02
ColumnWidth = 480.189
EndProperty
BeginProperty Column03
ColumnWidth = 1500.095
EndProperty
BeginProperty Column04
ColumnWidth = 1665.071
EndProperty
BeginProperty Column05
ColumnWidth = 1785.26
EndProperty
EndProperty
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 375
Left = 6840
TabIndex = 16
Top = 3075
Width = 1575
_ExtentX = 2778
_ExtentY = 661
_Version = 393216
Format = 60489729
CurrentDate = 39071
End
Begin VB.Label Label2
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 = 2760
TabIndex = 22
Top = 3120
Width = 600
End
Begin VB.Label Label3
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 = 2760
TabIndex = 21
Top = 3765
Width = 600
End
Begin VB.Label Label4
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 = 2760
TabIndex = 20
Top = 4320
Width = 600
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 = 5520
TabIndex = 19
Top = 3120
Width = 1200
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 = 5520
TabIndex = 18
Top = 3720
Width = 1200
End
Begin VB.Label Label7
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 = 5520
TabIndex = 17
Top = 4320
Width = 1200
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "选择专业,班级"
Height = 180
Left = 240
TabIndex = 0
Top = 240
Width = 1260
End
End
Attribute VB_Name = "frmxgxj"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Combo3_Click()
Combo2.Clear
Combo2.text = "请选择"
Adodc3.RecordSource = "select * from 班级 where 专业名称='" & Combo3.text & "'"
Adodc3.Refresh
If Adodc3.Recordset.RecordCount <> 0 Then
With Adodc3.Recordset
.MoveFirst
Do Until .EOF
Combo2.AddItem .Fields(0)
.MoveNext
Loop
End With
End If
End Sub
Private Sub Command1_Click()
Adodc2.RecordSource = "select * from 学籍 order by 学号"
Adodc2.Refresh
Set DataGrid1.DataSource = Adodc2
Adodc2.Recordset.AddNew
Text1.text = ""
Text2.text = ""
Combo1.text = "请选择"
DTPicker1.Value = "1985-12-16"
Combo2.text = "请选择"
Combo3.text = "请选择"
box (True)
Command3.Enabled = True
Command6.Enabled = True
Command7.Enabled = True
End Sub
Private Sub Command2_Click()
If Text1.text = "" Then
MsgBox "请输入学号", vbOKOnly, "提示"
Text1.SetFocus
Exit Sub
End If
If Text2.text = "" Then
MsgBox "请输入姓名", vbOKOnly, "提示"
Text2.SetFocus
Exit Sub
End If
Adodc2.Recordset("学号") = Text1.text
Adodc2.Recordset("姓名") = Text2.text
Adodc2.Recordset("性别") = Combo1.text
Adodc2.Recordset("出生日期") = DTPicker1.Value
Adodc2.Recordset("班级名称") = Combo2.text
Adodc2.Recordset("专业名称") = Combo3.text
Adodc2.Recordset.Update
MsgBox "更新成功", vbOKOnly, "成功提示"
Command2.Enabled = False
box (False)
End Sub
Private Sub Command3_Click()
Dim del As Integer
del = MsgBox("你确定要删除该记录吗?", vbYesNo + vbQuestion, "询问")
If del = vbYes Then
Adodc2.Recordset.Delete
Adodc2.Recordset.UpdateBatch
End If
End Sub
Private Sub Command4_Click()
Dim Myexit As Integer
Myexit = MsgBox("你保存数据了吗?", vbYesNo + vbQuestion, "询问")
If Myexit = vbYes Then
Unload Me
End If
End Sub
Private Sub Command5_Click()
box (True)
Command2.Enabled = True
End Sub
Private Sub Command6_Click()
Adodc2.Recordset.CancelBatch
Adodc2.Refresh
MsgBox "取消成功", vbOKOnly, "成功提示"
Command7.Enabled = False
Command6.Enabled = False
box (False)
End Sub
Private Sub Command7_Click()
If Text1.text = "" Then
MsgBox "请输入学号", vbOKOnly, "提示"
Text1.SetFocus
Exit Sub
End If
If Text2.text = "" Then
MsgBox "请输入姓名", vbOKOnly, "提示"
Text2.SetFocus
Exit Sub
End If
If Combo1.text = "请选择" Then
MsgBox "请选择性别", vbOKOnly, "提示"
Combo1.SetFocus
Exit Sub
End If
If Combo2.text = "请选择" Then
MsgBox "请选择班级", vbOKOnly, "提示"
Combo2.SetFocus
Exit Sub
End If
If Combo3.text = "请选择" Then
MsgBox "请选择专业", vbOKOnly, "提示"
Combo3.SetFocus
Exit Sub
End If
Adodc2.Recordset("学号") = Text1.text
Adodc2.Recordset("姓名") = Text2.text
Adodc2.Recordset("性别") = Combo1.text
Adodc2.Recordset("出生日期") = DTPicker1.Value
Adodc2.Recordset("班级名称") = Combo2.text
Adodc2.Recordset("专业名称") = Combo3.text
Adodc2.Recordset.UpdateBatch
MsgBox "保存成功", vbOKOnly, "成功提示"
Command7.Enabled = False
Command6.Enabled = False
Command3.Enabled = True
box (False)
End Sub
Private Sub DataGrid1_Click()
With Adodc2.Recordset
Text1.text = .Fields(0)
Text2.text = .Fields(1)
Combo1.text = .Fields(2)
DTPicker1.Value = .Fields(3)
Combo2.text = .Fields(4)
Combo3.text = .Fields(5)
End With
Command5.Enabled = True
End Sub
Private Sub Form_Load()
Combo1.AddItem "男"
Combo1.AddItem "女"
Dim a As String
Dim b As String
Adodc3.RecordSource = "select * from 班级 order by 班级名称"
Adodc3.Refresh
If Adodc3.Recordset.RecordCount <> 0 Then
With Adodc3.Recordset
.MoveFirst
b = ""
Do Until .EOF
a = .Fields(1)
If a <> b Then
Combo3.AddItem .Fields(1)
End If
b = a
.MoveNext
Loop
End With
End If
Adodc1.RecordSource = "select * from 班级 order by 专业名称"
Adodc1.Refresh
Dim mNode As Node
With Adodc1.Recordset
.MoveFirst
Set mNode = TreeView1.Nodes.Add(, , .Fields(1), .Fields(1), 1, 2)
a = .Fields(1)
.MoveNext
.MovePrevious
Do Until .EOF
b = a
a = .Fields(1)
If a <> b Then
Set mNode = TreeView1.Nodes.Add(b, tvwLast, a, a, 1, 2)
mNode.Tag = "专业"
.MovePrevious
Else
Set mNode = TreeView1.Nodes.Add(b, tvwChild, .Fields(0), .Fields(0), 1, 2)
mNode.Tag = "班级"
End If
.MoveNext
Loop
End With
box (False)
Command2.Enabled = False
Command3.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
If Text1.Enabled = True Then
If Text1.text = "" Then
MsgBox "输入完整的数据", vbOKOnly, "提示"
Cancel = 1
Text1.SetFocus
End If
Exit Sub
End If
If Text2.Enabled = True Then
If Text2.text = "" Then
MsgBox "输入完整的数据", vbOKOnly, "提示"
Cancel = 1
Text2.SetFocus
End If
Exit Sub
End If
If Combo1.Enabled = True Then
If Combo1.text = "请选择" Then
MsgBox "输入完整的数据", vbOKOnly, "提示"
Cancel = 1
Combo1.SetFocus
End If
Exit Sub
End If
If Combo2.Enabled = True Then
If Combo2.text = "请选择" Then
MsgBox "输入完整的数据", vbOKOnly, "提示"
Cancel = 1
Combo2.SetFocus
End If
Exit Sub
End If
If Combo3.Enabled = True Then
If Combo3.text = "请选择" Then
MsgBox "输入完整的数据", vbOKOnly, "提示"
Cancel = 1
Combo3.SetFocus
End If
Exit Sub
End If
End Sub
Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
Command5.Enabled = False
Command3.Enabled = False
Text1.text = ""
Text2.text = ""
Combo1.text = "请选择"
DTPicker1.Value = "2000-01-01"
Combo2.text = "请选择"
Combo3.text = "请选择"
If Node.Tag = "班级" Then
Adodc2.RecordSource = "select * from 学籍 where 班级名称='" & Node.Key & "' order by 学号"
Else
Adodc2.RecordSource = "select * from 学籍 where 专业名称='" & Node.Key & "' order by 学号"
End If
Adodc2.Refresh
If Adodc2.Recordset.RecordCount <> 0 Then
Set DataGrid1.DataSource = Adodc2
With Adodc2.Recordset
Text1.text = .Fields(0)
Text2.text = .Fields(1)
Combo1.text = .Fields(2)
DTPicker1.Value = .Fields(3)
Combo2.text = .Fields(4)
Combo3.text = .Fields(5)
End With
Command5.Enabled = True
Command3.Enabled = True
End If
End Sub
Private Sub box(x As Boolean)
Text1.Enabled = x
Text2.Enabled = x
Combo1.Enabled = x
DTPicker1.Enabled = x
Combo2.Enabled = x
Combo3.Enabled = x
End Sub
Private Sub Form_Initialize()
ChDrive App.Path
ChDir App.Path
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?