📄 frmuse.frm
字号:
VERSION 5.00
Begin VB.Form FrmUse
BorderStyle = 3 'Fixed Dialog
Caption = "用户登录"
ClientHeight = 3360
ClientLeft = 45
ClientTop = 330
ClientWidth = 3840
ControlBox = 0 'False
KeyPreview = -1 'True
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3360
ScaleWidth = 3840
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame2
Caption = "用户登录"
Height = 3255
Left = 1800
TabIndex = 2
Top = 120
Width = 2055
Begin VB.CommandButton CmdA
Caption = "用户注册"
Height = 375
Left = 600
TabIndex = 10
Top = 1600
Width = 855
End
Begin VB.TextBox TxtPW
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
IMEMode = 3 'DISABLE
Left = 120
MaxLength = 10
PasswordChar = "*"
TabIndex = 7
Top = 1200
Width = 1815
End
Begin VB.Frame Frame3
Height = 855
Left = 120
TabIndex = 8
Top = 1920
Width = 1815
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "打字高手是系统提供给无用户名的用户使用它不保存用户信息"
Height = 540
Left = 80
TabIndex = 9
Top = 240
Width = 1710
WordWrap = -1 'True
End
End
Begin VB.TextBox TxtName
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
MaxLength = 10
TabIndex = 5
Top = 480
Width = 1815
End
Begin VB.CommandButton Cmdok
Caption = "登录(&L)"
Height = 375
Left = 600
TabIndex = 3
Top = 2800
Width = 855
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "口令"
Height = 180
Left = 840
TabIndex = 6
Top = 960
Width = 360
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "用户名"
Height = 180
Left = 720
TabIndex = 4
Top = 240
Width = 540
End
End
Begin VB.Frame Frame1
Caption = "用户列表"
Height = 3255
Left = 0
TabIndex = 0
Top = 120
Width = 1815
Begin VB.ListBox LstUse
Height = 2940
Left = 60
TabIndex = 1
Top = 240
Width = 1695
End
End
End
Attribute VB_Name = "FrmUse"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub CmdA_Click()
On errar GoTo Err8
If TxtName.Text = Empty Or TxtPW.Text = Empty Then
MsgBox "不能有空值!", , "警告"
TxtName.SetFocus
Else
Set g_dbred = g_dbcon.Execute("select * from name_u where use_name='" & TxtName.Text & "'")
If Not g_dbred.EOF Then
MsgBox "有相同用户名存在!", , "警告"
TxtName.Text = Empty
TxtName.SetFocus
Else
g_dbcon.Execute ("insert into name_u values('" & TxtName.Text & "','" & TxtPW.Text & "')")
MsgBox "成功注册!", , "疯狂五笔"
g_dbcon.Close
Form_Load
End If
End If
Exit Sub
Err8:
MsgBox "无法写入数据可能是所破坏如果要恢复请与开发者联系", , "提示"
End
End Sub
Private Sub CmdC_Click()
Unload FrmMain
Unload Me
End Sub
Private Sub Cmdok_Click()
On errar GoTo ErrA
If TxtName.Text = Empty Or TxtPW.Text = Empty Then
MsgBox "不能有空值!", , "警告"
TxtName.SetFocus
Else
If TxtName = "打字高手" Then
UserStr = "打字高手"
g_dbcon.Close
Unload Me
Else
Set g_dbred = g_dbcon.Execute("select * from name_u where use_name='" & TxtName.Text & "' and use_pw='" & TxtPW.Text & "'")
If g_dbred.EOF Then
MsgBox "不存在的用户名!", , "警告"
Else
UserStr = TxtName.Text
g_dbcon.Close
Unload Me
End If
End If
End If
Exit Sub
ErrA:
MsgBox "无法查询数据库可能是所破坏如果要恢复请与开发者联系", , "提示"
End
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Call Cmdok_Click
End If
End Sub
Private Sub Form_Load()
On Error GoTo Err1
LstUse.Clear
g_dbcon.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\UseM.mdb;Persist Security Info=False")
Set g_dbred = g_dbcon.Execute("select * from Name_U")
While Not g_dbred.EOF
LstUse.AddItem (g_dbred.Fields(0).Value)
g_dbred.MoveNext
Wend
Exit Sub
Err1:
MsgBox "无法打开数据库可能是所破坏如果要恢复请与开发者联系", , "提示"
End
End Sub
Private Sub LstUse_Click()
If LstUse.Text = "打字高手" Then
TxtName.Text = LstUse.Text
TxtPW.Text = "000000"
Else
TxtName.Text = LstUse.Text
TxtPW.Text = Empty
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -