ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Select or Enter into a TextBox on a UserForm (https://www.excelbanter.com/excel-programming/403600-select-enter-into-textbox-userform.html)

RyanH

Select or Enter into a TextBox on a UserForm
 
I am designing a Login Userform. If the user enters the wrong password I
want to delete the text they entered and then have the textbox selected so
they can begin typing automatically. Any suggestions would be great!

Dan R.

Select or Enter into a TextBox on a UserForm
 
If TextBox1.Text < "password" Then
MsgBox "Invalid Password", vbCritical
TextBox1.SetFocus
TextBox1 = ""
End If

--
Dan

On Jan 3, 1:57*pm, RyanH wrote:
I am designing a Login Userform. *If the user enters the wrong password I
want to delete the text they entered and then have the textbox selected so
they can begin typing automatically. *Any suggestions would be great!


RyanH

Select or Enter into a TextBox on a UserForm
 
Ahhhhhh. Stupid me, I had this:

If TextBox1.Text < "password" Then
MsgBox "Invalid Password", vbCritical
TextBox1 = ""
TextBox1.SetFocus
End If

all I had to do is switch SetFocus and ""

Thanks for the help and the quick response

"Dan R." wrote:

If TextBox1.Text < "password" Then
MsgBox "Invalid Password", vbCritical
TextBox1.SetFocus
TextBox1 = ""
End If

--
Dan

On Jan 3, 1:57 pm, RyanH wrote:
I am designing a Login Userform. If the user enters the wrong password I
want to delete the text they entered and then have the textbox selected so
they can begin typing automatically. Any suggestions would be great!




All times are GMT +1. The time now is 04:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com