📄 fmnew.frm
字号:
VERSION 5.00
Begin VB.Form fmNew
BackColor = &H00000000&
Caption = "新建用户"
ClientHeight = 2205
ClientLeft = 60
ClientTop = 420
ClientWidth = 3615
LinkTopic = "Form1"
ScaleHeight = 2205
ScaleWidth = 3615
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton cmdCancel
Caption = "取 消"
Height = 300
Left = 2040
TabIndex = 5
Top = 1680
Width = 735
End
Begin VB.CommandButton cmdAdd
Caption = "添 加"
Default = -1 'True
Height = 300
Left = 840
TabIndex = 4
Top = 1680
Width = 735
End
Begin VB.TextBox txtPwd
Appearance = 0 'Flat
Height = 270
IMEMode = 3 'DISABLE
Left = 960
PasswordChar = "*"
TabIndex = 3
Top = 960
Width = 2295
End
Begin VB.TextBox txtUser
Appearance = 0 'Flat
Height = 270
Left = 960
TabIndex = 2
Top = 435
Width = 2295
End
Begin VB.Label Label2
AutoSize = -1 'True
BackColor = &H00000000&
Caption = "密 码:"
ForeColor = &H0000FF00&
Height = 180
Left = 240
TabIndex = 1
Top = 1005
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H00000000&
Caption = "用户名:"
ForeColor = &H0000FF00&
Height = 180
Left = 240
TabIndex = 0
Top = 480
Width = 630
End
End
Attribute VB_Name = "fmNew"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdAdd_Click()
Dim szUserName As String
Dim szPwd As String
Dim len1, len2 As String
szUserName = Trim(txtUser.Text)
szPwd = txtPwd.Text
len1 = Len(szUserName)
len2 = Len(szPwd)
If len1 > 0 Then
If len1 > 16 Or len1 < 4 Then
MsgBox "用户名长度为4-16个字符"
Exit Sub
End If
If len2 > 0 Then
If len2 > 16 Or len2 < 6 Then
MsgBox "密码长度为6-16个字符"
Exit Sub
End If
If Not IsExist(szUserName) Then
AddNewUser szUserName, szPwd
MsgBox "添加成功!"
Unload Me
Else
MsgBox "该用户已经存在"
End If
Else
MsgBox "请输入密码"
End If
Else
MsgBox "请输入用户名"
End If
End Sub
Private Sub cmdCancel_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -