📄 form5.frm
字号:
Begin VB.TextBox Text3
Height = 315
Left = 6150
TabIndex = 12
Text = "Text3"
Top = 330
Width = 1545
End
Begin VB.TextBox Text2
Height = 315
Left = 3630
TabIndex = 11
Text = "Text2"
Top = 720
Width = 1395
End
Begin VB.ComboBox Combo2
Height = 300
ItemData = "Form5.frx":00CA
Left = 3630
List = "Form5.frx":00DD
TabIndex = 10
Text = "Combo2"
Top = 330
Width = 1395
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "Form5.frx":0115
Left = 1290
List = "Form5.frx":0137
TabIndex = 9
Text = "Combo1"
Top = 750
Width = 1335
End
Begin VB.TextBox Text1
Height = 315
Left = 1290
TabIndex = 8
Text = "Text1"
Top = 330
Width = 1305
End
Begin VB.Label Label6
Caption = "人 数"
Height = 285
Left = 5280
TabIndex = 7
Top = 360
Width = 1005
End
Begin VB.Label Label5
Caption = "教 室"
Height = 255
Left = 2790
TabIndex = 6
Top = 780
Width = 765
End
Begin VB.Label Label4
Caption = "所属院系"
Height = 285
Left = 2820
TabIndex = 5
Top = 360
Width = 795
End
Begin VB.Label Label3
Caption = "辅 导 员"
Height = 285
Left = 360
TabIndex = 4
Top = 810
Width = 885
End
Begin VB.Label Label2
Caption = "班级名称"
Height = 285
Left = 390
TabIndex = 3
Top = 360
Width = 825
End
End
End
Begin VB.Line Line1
BorderColor = &H80000015&
X1 = 30
X2 = 9420
Y1 = 660
Y2 = 660
End
Begin VB.Label Label1
Caption = "班级管理"
BeginProperty Font
Name = "黑体"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000015&
Height = 405
Left = 3750
TabIndex = 0
Top = 240
Width = 1515
End
End
Attribute VB_Name = "Form5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdadd_Click()
Adodc1.Recordset.AddNew
Text1.SetFocus
End Sub
Private Sub cmdall_Click()
Set DataGrid2.DataSource = Adodc1
DataGrid2.Refresh
End Sub
Private Sub cmdchange_Click()
Dim sql As String
Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb"
Adodc2.CommandType = adCmdText
sql = "select * from class"
Adodc2.RecordSource = sql
Adodc2.Recordset.Update
Set DataGrid2.DataSource = Adodc2
DataGrid2.Refresh
Set Text4.DataSource = Adodc2
Set Text5.DataSource = Adodc2
Set Text6.DataSource = Adodc2
Set Text7.DataSource = Adodc2
Set Text8.DataSource = Adodc2
Text4.DataField = "班级名称"
Text5.DataField = "辅导员"
Text6.DataField = "所属院系"
Text7.DataField = "教室"
Text8.DataField = "人数"
If cmdchange.Caption = "修 改" Then
cmdchange.Caption = "确认修改"
Text4.Enabled = True
Text5.Enabled = True
Text6.Enabled = True
Text7.Enabled = True
Text8.Enabled = True
Adodc2.Recordset.Fields(0) = Text4.Text
Adodc2.Recordset.Fields(1) = Text6.Text
Adodc2.Recordset.Fields(2) = Text5.Text
Adodc2.Recordset.Fields(3) = Text7.Text
Adodc2.Recordset.Fields(4) = Text8.Text
Else
cmdchange.Caption = "修改"
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Text7.Enabled = False
Text8.Enabled = False
End If
End Sub
Private Sub cmddel_Click()
Dim i As Integer
i = MsgBox("是否真的删除该学生学籍?", vbYesNo + vbQuestion, "提示")
If i = vbYes Then
Adodc3.Recordset.Delete
DoEvents
Adodc3.Recordset.MoveFirst
DataGrid3.Refresh
End If
End Sub
Private Sub cmdfind_Click()
Dim sql As String
Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb"
Adodc2.CommandType = adCmdText
If Option1.Value = True Then
sql = "select * from class where 班级名称='" & DataCombo1.Text & "'"
End If
If Option2.Value = True Then
sql = "select * from class where 辅导员 ='" & Combo4.Text & "'"
End If
Adodc2.RecordSource = sql
Adodc2.Refresh
Set DataGrid2.DataSource = Adodc2
DataGrid2.Refresh
Set Text4.DataSource = Adodc2
Set Text5.DataSource = Adodc2
Set Text6.DataSource = Adodc2
Set Text7.DataSource = Adodc2
Set Text8.DataSource = Adodc2
Text4.DataField = "班级名称"
Text5.DataField = "辅导员"
Text6.DataField = "所属院系"
Text7.DataField = "教室"
Text8.DataField = "人数"
End Sub
Private Sub cmdrall_Click()
Set DataGrid2.DataSource = Adodc2
Set Text4.DataSource = Adodc2
Set Text5.DataSource = Adodc2
Set Text6.DataSource = Adodc2
Set Text7.DataSource = Adodc2
Set Text8.DataSource = Adodc2
Text4.DataField = "班级名称"
Text5.DataField = "辅导员"
Text6.DataField = "所属院系"
Text7.DataField = "教室"
Text8.DataField = "人数"
Adodc2.Recordset.Fields(0) = Text4.Text
Adodc2.Recordset.Fields(1) = Text6.Text
Adodc2.Recordset.Fields(2) = Text5.Text
Adodc2.Recordset.Fields(3) = Text7.Text
Adodc2.Recordset.Fields(4) = Text8.Text
Adodc2.Refresh
Adodc1.Refresh
Adodc2.RecordSource = "select * from class"
DataGrid2.Refresh
DataGrid1.Refresh
End Sub
Private Sub cmdrfind_Click()
Dim sql As String
Adodc3.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb"
Adodc3.CommandType = adCmdText
sql = "select * from class where 班级名称='" & DataCombo2.Text & "'"
Adodc3.RecordSource = sql
Adodc3.Refresh
Set DataGrid3.DataSource = Adodc3
DataGrid3.Refresh
End Sub
Private Sub cmdrnew_Click()
Dim sql As String
Adodc3.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb"
Adodc3.CommandType = adCmdText
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb"
Adodc1.CommandType = adCmdText
sql = "select * from class"
Adodc3.RecordSource = sql
Adodc1.RecordSource = sql
Set DataGrid3.DataSource = Adodc3
Set DataGrid1.DataSource = Adodc1
Adodc1.Refresh
Adodc3.Refresh
DataGrid1.Refresh
DataGrid3.Refresh
End Sub
Private Sub cmdsave_Click()
Adodc1.Recordset.Fields(0) = Text1.Text
Adodc1.Recordset.Fields(1) = Combo2.Text
Adodc1.Recordset.Fields(2) = Combo1.Text
Adodc1.Recordset.Fields(3) = Text2.Text
Adodc1.Recordset.Fields(4) = Text3.Text
Adodc1.Recordset.Update
DataGrid1.Refresh
End Sub
Private Sub Command2_Click()
End Sub
Private Sub Command6_Click()
Adodc1.Recordset.Close
Unload Me
End Sub
Private Sub Form_Load()
Dim sql As String
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb"
Adodc1.CommandType = adCmdText
sql = "select * from class"
Adodc1.RecordSource = sql
Set DataGrid1.DataSource = Adodc1
Set Text1.DataSource = Adodc1
Set Combo2.DataSource = Adodc1
Set Text3.DataSource = Adodc1
Set Combo1.DataSource = Adodc1
Set Text2.DataSource = Adodc1
Text1.DataField = "班级名称"
Combo2.DataField = "所属院系"
Text3.DataField = "人数"
Combo1.DataField = "辅导员"
Text2.DataField = "教室"
Set DataCombo1.RowSource = Adodc1
DataCombo1.ListField = "班级名称"
Set DataCombo2.RowSource = Adodc1
DataCombo2.ListField = "班级名称"
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Text7.Enabled = False
Text8.Enabled = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -