📄 frmusername.frm
字号:
VERSION 5.00
Begin VB.Form frmUserName
BorderStyle = 3 'Fixed Dialog
Caption = "用户信息"
ClientHeight = 1605
ClientLeft = 45
ClientTop = 330
ClientWidth = 3660
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1605
ScaleWidth = 3660
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "取消(&C)"
Height = 375
Left = 2520
TabIndex = 3
Top = 1080
Width = 975
End
Begin VB.TextBox txtUserName
Height = 300
Left = 1080
TabIndex = 1
Top = 600
Width = 2415
End
Begin VB.TextBox txtUserLogin
Height = 300
Left = 1080
TabIndex = 0
Top = 120
Width = 2415
End
Begin VB.CommandButton cmdOK
Caption = "确定(&O)"
Height = 375
Left = 1560
TabIndex = 2
Top = 1080
Width = 975
End
Begin VB.Label lblUserName
Caption = "用户名称:"
Height = 165
Left = 120
TabIndex = 5
Top = 668
Width = 975
End
Begin VB.Label lblUserLogin
Caption = "用户工号:"
Height = 160
Left = 120
TabIndex = 4
Top = 190
Width = 975
End
End
Attribute VB_Name = "frmUserName"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public m_sLogin As String
Public m_sName As String
Public m_bCancel As Boolean
Public Sub Init()
On Error Resume Next
txtUserLogin.Text = m_sLogin
txtUserName.Text = m_sName
txtUserLogin.SetFocus
End Sub
Private Sub cmdCancel_Click()
On Error Resume Next
m_bCancel = True
Unload Me
End Sub
Private Sub cmdOK_Click()
On Error Resume Next
If Trim$(txtUserLogin.Text) = "" Then
MsgBox "员工工号不能为空!", vbOKOnly, "系统提示"
Exit Sub
End If
m_sLogin = txtUserLogin.Text
m_sName = txtUserName.Text
m_bCancel = False
Unload Me
End Sub
Private Sub Form_Load()
On Error Resume Next
m_bCancel = True
m_sLogin = ""
m_sName = ""
End Sub
Private Sub Form_Terminate()
On Error Resume Next
Set frmUserName = Nothing
End Sub
Private Sub txtUserLogin_GotFocus()
On Error Resume Next
txtUserLogin.BackColor = &H80000018
End Sub
Private Sub txtUserLogin_KeyPress(KeyAscii As Integer)
On Error Resume Next
If KeyAscii = 13 Then '是回车键?
KeyAscii = 0 '0取消输入
SendKeys "{tab}"
End If
End Sub
Private Sub txtUserLogin_LostFocus()
On Error Resume Next
txtUserLogin.BackColor = &H80000005
End Sub
Private Sub txtUserName_GotFocus()
On Error Resume Next
txtUserName.BackColor = &H80000018
End Sub
Private Sub txtUserName_KeyPress(KeyAscii As Integer)
On Error Resume Next
If KeyAscii = 13 Then '是回车键?
KeyAscii = 0 '0取消输入
SendKeys "{tab}"
End If
End Sub
Private Sub txtUserName_LostFocus()
On Error Resume Next
txtUserName.BackColor = &H80000005
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -