📄 form3.frm
字号:
VERSION 5.00
Begin VB.Form Form3
Caption = "用户编辑"
ClientHeight = 3645
ClientLeft = 60
ClientTop = 450
ClientWidth = 6210
LinkTopic = "Form3"
ScaleHeight = 3645
ScaleWidth = 6210
StartUpPosition = 1 '所有者中心
Begin VB.CheckBox ck
Caption = "连续增加"
Height = 375
Left = 240
TabIndex = 6
Top = 3000
Width = 1335
End
Begin VB.CommandButton Command2
Caption = "退 出"
Height = 495
Left = 4320
TabIndex = 5
Top = 3000
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "保 存"
Height = 495
Left = 2640
TabIndex = 4
Top = 3000
Width = 1215
End
Begin VB.TextBox Text2
Height = 375
Left = 1440
TabIndex = 1
Text = "Text2"
Top = 1200
Width = 2295
End
Begin VB.TextBox Text1
Height = 375
Left = 1440
TabIndex = 0
Text = "Text1"
Top = 480
Width = 1695
End
Begin VB.Label Label2
Caption = "密码"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 360
TabIndex = 3
Top = 1200
Width = 975
End
Begin VB.Label Label1
Caption = "用户名"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 360
TabIndex = 2
Top = 480
Width = 975
End
End
Attribute VB_Name = "Form3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim t_ As String
Public Sub setType(t As String)
t_ = t
End Sub
Private Sub Command1_Click()
If Trim(Text1) = "" Then
Text1.SetFocus
End If
If t_ = "add" Then
If rec_user.State = adStateOpen Then
rec_user.AddNew
rec_user.Fields("用户名") = Trim(Text1)
rec_user.Fields("密码") = Trim(Text2)
rec_user.Update
End If
End If
If t_ = "modify" Then
If rec_user.State = adStateOpen Then
rec_user.Fields("用户名") = Trim(Text1)
rec_user.Fields("密码") = Trim(Text2)
rec_user.Update
End If
End If
If ck.Value <> 1 Then
Unload Me
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
't_ = "add"
Text1 = ""
Text2 = ""
If t_ = "modify" Then
If rec_user.State = adStateOpen And Not rec_user.EOF And Not rec_user.BOF Then
Text1 = rec_user.Fields("用户名")
Text2 = rec_user.Fields("密码")
End If
ck.Visible = False
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -