frmyhcj.frm
来自「企业工资管理系统的具体实现」· FRM 代码 · 共 216 行
FRM
216 行
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmyhcj
Caption = "创建用户"
ClientHeight = 3915
ClientLeft = 2280
ClientTop = 1995
ClientWidth = 6405
Icon = "frmyhcj.frx":0000
LinkTopic = "Form1"
ScaleHeight = 3915
ScaleWidth = 6405
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 3960
Top = 150
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 360
Left = 5160
TabIndex = 10
Top = 3510
Width = 1170
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 360
Left = 3975
TabIndex = 9
Top = 3510
Width = 1170
End
Begin VB.TextBox Text3
Height = 360
IMEMode = 3 'DISABLE
Left = 3525
PasswordChar = "*"
TabIndex = 8
Top = 2865
Width = 2790
End
Begin VB.TextBox Text2
Height = 360
IMEMode = 3 'DISABLE
Left = 3525
PasswordChar = "*"
TabIndex = 6
Top = 2235
Width = 2790
End
Begin VB.TextBox Text1
Height = 360
Left = 3525
TabIndex = 2
Top = 960
Width = 2790
End
Begin VB.Label Label6
Caption = "确认密码:"
Height = 285
Left = 2430
TabIndex = 7
Top = 2970
Width = 960
End
Begin VB.Label Label5
Caption = "新密码:"
Height = 330
Left = 2430
TabIndex = 5
Top = 2340
Width = 1050
End
Begin VB.Label Label4
Caption = "在第一个框中输入密码,再在第二个框中输入同一密码以确认是否正确。"
Height = 390
Left = 2430
TabIndex = 4
Top = 1620
Width = 3945
End
Begin VB.Label Label3
Caption = "用户名:"
Height = 345
Left = 2430
TabIndex = 3
Top = 1050
Width = 1065
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "输入最大长度为50个字符的用户名。"
Height = 180
Left = 2430
TabIndex = 1
Top = 630
Width = 2880
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "创建新用户"
Height = 180
Left = 2430
TabIndex = 0
Top = 135
Width = 900
End
Begin VB.Image Image1
Height = 3975
Left = 0
Picture = "frmyhcj.frx":030A
Stretch = -1 'True
Top = -45
Width = 2265
End
End
Attribute VB_Name = "frmyhcj"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Call cmcreate
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Sub cmcreate()
Dim cnn As New ADODB.Recordset
Dim cnn1 As New ADODB.Recordset
If Trim(Text1.Text) = "" Then
MsgBox "请输入用户名!", vbCritical, "创建用户名"
Text1.SetFocus
Exit Sub
ElseIf Trim(Text2.Text) <> Trim(Text3.Text) Then
MsgBox "密码不对,请重新输入!", vbCritical, "密码"
Text3.Text = ""
Text3.SetFocus
Exit Sub
End If
With Adodc1
.ConnectionString = constr
.RecordSource = "select * from mmb where yhm='" & Trim(Text1.Text) & "'"
.Refresh
If .Recordset.EOF And .Recordset.BOF Then
.Recordset.AddNew
.Recordset.Fields("yhm").Value = Trim(Text1.Text)
.Recordset.Fields("yhmm").Value = Trim(Text2.Text)
.Recordset.Update
Else
MsgBox "此用户已经存在,请输入新用户名。", vbCritical, "创建新用户"
Text1.Text = ""
Text1.SetFocus
Exit Sub
End If
End With
frmyhsz.List1.AddItem Trim(Text1.Text)
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text1.SetFocus
MsgBox "新用户创建成功!", vbInformation, "提示"
Unload Me
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call cmcreate
End If
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?