📄 添加用户.frm
字号:
VERSION 5.00
Begin VB.Form Form3
Caption = "添加用户"
ClientHeight = 5505
ClientLeft = 60
ClientTop = 450
ClientWidth = 8115
LinkTopic = "Form3"
MDIChild = -1 'True
Picture = "添加用户.frx":0000
ScaleHeight = 5505
ScaleWidth = 8115
WindowState = 2 'Maximized
Begin VB.CommandButton cmdexit
BackColor = &H00C0C0C0&
Caption = "退 出"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 5280
Style = 1 'Graphical
TabIndex = 4
Top = 3960
Width = 1215
End
Begin VB.CommandButton cmdok
BackColor = &H00C0C0C0&
Caption = "确 认"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1440
Style = 1 'Graphical
TabIndex = 3
Top = 3960
Width = 1215
End
Begin VB.TextBox txtpassword2
BackColor = &H00E0E0E0&
Height = 495
IMEMode = 3 'DISABLE
Left = 4440
PasswordChar = "*"
TabIndex = 2
Top = 2520
Width = 2535
End
Begin VB.TextBox txtpassword1
BackColor = &H00E0E0E0&
Height = 495
IMEMode = 3 'DISABLE
Left = 4440
PasswordChar = "*"
TabIndex = 1
Top = 1440
Width = 2535
End
Begin VB.TextBox txtusername
BackColor = &H00E0E0E0&
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4440
TabIndex = 0
Top = 600
Width = 2535
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "请输入密码"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 495
Left = 1440
TabIndex = 7
Top = 1560
Width = 1815
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "请输入用户名"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 495
Left = 1440
TabIndex = 6
Top = 720
Width = 1935
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "请确认您的密码"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 615
Left = 1440
TabIndex = 5
Top = 2520
Width = 1935
End
End
Attribute VB_Name = "Form3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdexit_Click()
FrmMain.Show
Form3.Hide
End Sub
Private Sub cmdOK_Click()
Dim txtsql As String, mrc As Adodb.Recordset, msgtext As String
If Trim(txtusername.Text) = "" Then
FrmMain.StatusBarmy.Panels.Item(1).Text = "请输入用户名"
txtusername.SetFocus: Exit Sub
Else
txtsql = "select * from user_info"
Set mrc = executesql(txtsql, msgtext)
While (mrc.EOF = False)
If Trim(mrc.Fields(0)) = Trim(txtusername.Text) Then
FrmMain.StatusBarmy.Panels.Item(1).Text = "该用户已存在,请重输!"
txtusername.SetFocus
txtusername.Text = ""
txtpassword1.Text = ""
txtpassword2.Text = ""
Exit Sub
Else
mrc.MoveNext
End If
Wend
End If
If Trim(txtpassword1.Text) = "" Then
FrmMain.StatusBarmy.Panels.Item(1).Text = "为了安全,密码不为空!"
txtpassword1.SetFocus
txtpassword1.Text = ""
txtpassword2.Text = ""
Else
If Trim(txtpassword2.Text) <> Trim(txtpassword2.Text) Then
FrmMain.StatusBarmy.Panels.Item(1).Text = "密码输入不一致"
txtpassword1.SetFocus
txtpassword1.Text = ""
txtpassword2.Text = ""
Exit Sub
Else
mrc.AddNew '添加新记录并写入表内
mrc.Fields(0) = Trim(txtusername.Text)
mrc.Fields(1) = Trim(txtpassword1.Text)
mrc.Update
mrc.Close
Me.Hide
FrmMain.StatusBarmy.Panels.Item(1).Text = "添加用户成功!"
End If
End If
End Sub
Private Sub Form_Load()
Form3.Show
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -