📄 form3.frm
字号:
VERSION 5.00
Begin VB.Form Form3
BorderStyle = 3 'Fixed Dialog
Caption = "学生信息修改"
ClientHeight = 4620
ClientLeft = 3075
ClientTop = 3210
ClientWidth = 5310
LinkTopic = "Form3"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 4620
ScaleWidth = 5310
ShowInTaskbar = 0 'False
Begin VB.TextBox Text5
Height = 615
Left = 1320
TabIndex = 12
Top = 3720
Width = 3255
End
Begin VB.TextBox Text4
Height = 270
Left = 1320
TabIndex = 11
Top = 3240
Width = 1575
End
Begin VB.Frame Frame2
Caption = "学生信息修改"
Height = 3375
Left = 120
TabIndex = 3
Top = 1200
Width = 5055
Begin VB.CommandButton Command4
BackColor = &H00FF8080&
Caption = "退出"
Height = 375
Left = 3600
Style = 1 'Graphical
TabIndex = 16
Top = 1920
Width = 855
End
Begin VB.CommandButton Command3
BackColor = &H00FF8080&
Caption = "保存"
Height = 375
Left = 3600
Style = 1 'Graphical
TabIndex = 15
Top = 960
Width = 855
End
Begin VB.CommandButton Command2
BackColor = &H00FF8080&
Caption = "修改"
Height = 375
Left = 3600
Style = 1 'Graphical
TabIndex = 14
Top = 480
Width = 855
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "Form3.frx":0000
Left = 1200
List = "Form3.frx":000A
TabIndex = 13
Top = 960
Width = 1575
End
Begin VB.TextBox Text3
Height = 270
Left = 1200
TabIndex = 10
Top = 1440
Width = 1575
End
Begin VB.TextBox Text2
Height = 270
Left = 1200
TabIndex = 9
Top = 480
Width = 1575
End
Begin VB.Label Label6
Caption = "家庭地址:"
Height = 255
Left = 120
TabIndex = 8
Top = 2520
Width = 1095
End
Begin VB.Label Label4
Caption = "出生年月:"
Height = 255
Left = 120
TabIndex = 7
Top = 2010
Width = 975
End
Begin VB.Label Label3
Caption = "专业:"
Height = 255
Left = 480
TabIndex = 6
Top = 1500
Width = 855
End
Begin VB.Label Label2
Caption = "性别:"
Height = 255
Left = 480
TabIndex = 5
Top = 990
Width = 735
End
Begin VB.Label Label1
Caption = "姓名:"
Height = 255
Left = 480
TabIndex = 4
Top = 480
Width = 855
End
End
Begin VB.Frame Frame1
Caption = "输入学生学号"
Height = 975
Left = 120
TabIndex = 0
Top = 120
Width = 5055
Begin VB.CommandButton Command1
BackColor = &H00FF8080&
Caption = "确定"
Height = 375
Left = 3600
Style = 1 'Graphical
TabIndex = 2
Top = 360
Width = 855
End
Begin VB.TextBox Text1
Height = 375
Left = 840
TabIndex = 1
Top = 360
Width = 2055
End
End
End
Attribute VB_Name = "Form3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Conn As New ADODB.Connection
Dim Rs As New ADODB.Recordset
'学生基本数据修改窗体用来显示数据库中字段
Sub Showtext()
Text2.Text = Rs("姓名")
Combo1.Text = Rs("性别")
Text5.Text = Rs("家庭地址")
Text3.Text = Rs("专业")
Text4.Text = Rs("出生年月")
End Sub
Private Sub Command1_Click()
Dim Txtsql As String
Txtsql = "select * from 学生基本信息表 where "
Txtsql = Txtsql & "学号= '" & Trim(Text1.Text) & "'"
Set Rs = ExecuteSQL(Txtsql)
Call Showtext
End Sub
Private Sub Command2_Click()
Text1.Enabled = True
Text2.Enabled = True
Combo1.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text5.Enabled = True
Text1.Text = ""
Text2.Text = ""
Combo1.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = True
End Sub
Private Sub Command3_Click()
Rs("姓名") = Text2.Text
Rs("性别") = Combo1.Text
Rs("家庭地址") = Text5.Text
Rs("专业") = Text3.Text
Rs("出生年月") = Text4.Text
Rs.Update
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Combo1.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Command1.Enabled = False
Command2.Enabled = True
Command3.Enabled = False
End Sub
Private Sub Command4_Click()
Unload Me
Conn.Close
End Sub
Private Sub Form_Load()
Text1.Enabled = False
Text2.Enabled = False
Combo1.Enabled = False
Text5.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Command1.Enabled = False
Command3.Enabled = False
connstr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\学生信息管理.mdb"
Conn.Open connstr
'Rs.Open "学生基本信息表", Conn, adOpenKeyset, adLockPessimistic
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text4.SetFocus
End If
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command3.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -