excel - 当我只使用数字作为密码时,它不会被检测到
问题描述
I created an account to the database with a password which only consists of numbers, and when I try to log in using that account the system rejects and displays the message box "Sorry, the password you entered is wrong!".
which means that if I create an account in the database using only numeric passwords, it will not be detected as the correct password.
I really appreciate the person who can correct my coding error.
Private Sub BTLogin_Click()
If txtusername.Value = "" Or txtpass.Value = "" Then
MsgBox "Username / Password cannot be empty!", vbExclamation, "Warning"
txtusername.SetFocus
Else
Dim iRow As Long
Dim Ws As Worksheet
Set Ws = Worksheets("Administrator")
iRow = Ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
If WorksheetFunction.CountIf(Ws.Range("A3", Ws.Cells(iRow - 1, 3)), Me.txtusername.Value) > 0 Then
Nomor = Trim(Me.txtusername.Value)
With Sheets("Administrator")
Baris = .Columns("A").Find(Nomor).Row
PasswordUser = Range("B" & Baris).Value
End With
If txtpass.Value <> PasswordUser Then
MsgBox "Sorry, the password you entered is wrong!", vbCritical, "Error"
txtpass.Text = ""
txtpass.SetFocus
Else
MsgBox "Login Success", vbInformation, "Success"
Unload Me
Application.Visible = True
End If
Else
MsgBox "User not registered. Please contact the administrator", vbCritical, "Warning"
txtusername.Text = ""
txtpass.Text = ""
txtusername.SetFocus
Exit Sub
End If
End If
End Sub
解决方案
推荐阅读
- javascript - 在 React 中将所有元素保存在对象数组中的方法
- java - mockserver-netty 测试不起作用
- opengl - 如何在 GLFW 窗口中以固定 FPS 渲染
- css - 一个元素的位置是绝对的,另一个的位置是相对的,哪个是上
- javascript - 如何将字符串转换为日期并在 JavaScript 中设置默认时区
- javascript - 使用 d3 自定义气泡位置
- config - HtmlPurifier - 不断删除我的表格 - 什么是正确的配置?
- c++ - 从可调用可变元组中的函数结果创建元组
- go - 如果在恐慌之后放置 Golang 延迟不起作用?
- c# - 调用 nuGet 包中的代码时,GDI+ 中发生一般错误