📄 form3.frm
字号:
VERSION 5.00
Begin VB.Form Form3
BorderStyle = 3 'Fixed Dialog
Caption = "课程基本情况"
ClientHeight = 4590
ClientLeft = 45
ClientTop = 330
ClientWidth = 6495
LinkTopic = "Form3"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 4590
ScaleWidth = 6495
ShowInTaskbar = 0 'False
Begin VB.CommandButton Command1
Caption = "删除"
Height = 375
Index = 6
Left = 3720
TabIndex = 13
Top = 3840
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "修改"
Height = 375
Index = 5
Left = 2520
TabIndex = 12
Top = 3840
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "添加"
Height = 375
Index = 4
Left = 1200
TabIndex = 11
Top = 3840
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "尾记录"
Height = 375
Index = 3
Left = 4080
TabIndex = 10
Top = 3480
Width = 975
End
Begin VB.CommandButton Command1
Caption = "下一记录"
Height = 375
Index = 2
Left = 3120
TabIndex = 9
Top = 3480
Width = 975
End
Begin VB.CommandButton Command1
Caption = "上一记录"
Height = 375
Index = 1
Left = 2160
TabIndex = 8
Top = 3480
Width = 975
End
Begin VB.CommandButton Command1
Caption = "首记录"
Height = 375
Index = 0
Left = 1200
TabIndex = 7
Top = 3480
Width = 975
End
Begin VB.Frame Frame1
Caption = "学生信息"
Height = 2775
Left = 360
TabIndex = 0
Top = 360
Width = 5655
Begin VB.TextBox Text5
Enabled = 0 'False
Height = 375
Left = 1440
TabIndex = 16
Top = 1200
Width = 1095
End
Begin VB.TextBox Text4
Enabled = 0 'False
Height = 375
Left = 1440
TabIndex = 14
Top = 1800
Width = 1095
End
Begin VB.TextBox Text3
Enabled = 0 'False
Height = 375
Left = 3720
TabIndex = 3
Top = 1200
Width = 1095
End
Begin VB.TextBox Text2
Enabled = 0 'False
Height = 375
Left = 3720
TabIndex = 2
Top = 1800
Width = 1095
End
Begin VB.TextBox Text1
Enabled = 0 'False
Height = 375
Left = 1440
TabIndex = 1
Top = 480
Width = 3375
End
Begin VB.Label Label5
Caption = "课 序 号:"
Height = 255
Left = 480
TabIndex = 17
Top = 1320
Width = 975
End
Begin VB.Label Label4
Caption = "任课教师:"
Height = 255
Left = 480
TabIndex = 15
Top = 1920
Width = 975
End
Begin VB.Label Label3
Caption = "学 分:"
Height = 255
Left = 3000
TabIndex = 6
Top = 1320
Width = 975
End
Begin VB.Label Label2
Caption = "学 时:"
Height = 255
Left = 3000
TabIndex = 5
Top = 1920
Width = 975
End
Begin VB.Label Label1
Caption = "课程名称:"
Height = 255
Left = 480
TabIndex = 4
Top = 600
Width = 975
End
End
End
Attribute VB_Name = "Form3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs_test As New ADODB.Recordset
Private Sub Form_Load()
Dim sql As String
If X = 0 Then
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Command1(4).Visible = False
Command1(5).Visible = False
Command1(6).Visible = False
Else
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text5.Enabled = True
Command1(4).Visible = True
Command1(5).Visible = True
Command1(6).Visible = True
Label4.Caption = "教师编号"
End If
sql = "select * from teacher,kecheng,lesson where kecheng.t_id=teacher.t_ID and kecheng.l_id=lesson.l_id"
Call Conn
rs_test.Open sql, Module1.conn_mdb, 3, 3
rs_test.MoveFirst
Call shows
X = 0
End Sub
Private Sub Command1_Click(Index As Integer)
Select Case Index
Case 0 '首记录
rs_test.MoveFirst
Call shows
Case 1 '上一记录
If Not rs_test.BOF Then
rs_test.MovePrevious
Call shows
End If
Case 2 '下一记录
If Not rs_test.EOF Then
rs_test.MoveNext
Call shows
End If
Case 3 '尾记录
rs_test.MoveLast
Call shows
Case 4 '添加
rs_test.AddNew
rs_test("l_name") = Text1.Text
rs_test("l_time") = Text2.Text
rs_test("l_fen") = Text3.Text
rs_test("t_id") = Text4.Text
rs_test("l_id") = Text5.Text
rs_test.Update
Case 5 '编辑
rs_test("l_name") = Text1.Text
rs_test("l_time") = Text2.Text
rs_test("l_fen") = Text3.Text
rs_test("t_id") = Text4.Text
rs_test("l_id") = Text5.Text
rs_test.Update
Case 6 '删除
rs_test.Delete
rs_test.Update
rs_test.MoveFirst
End Select
End Sub
Private Sub shows()
If Not rs_test.EOF And Not rs_test.BOF Then
Text1.Text = rs_test("l_name")
Text2.Text = rs_test("l_time")
Text3.Text = rs_test("l_fen")
Text4.Text = rs_test("t_name")
If X = 1 Then
Text4.Text = rs_test("t_id")
End If
Text5.Text = rs_test("l_id")
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call conclose
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -