Dartshark
New member
I created a form to capture a user name and password.
I thought it would be nice, during the form load event, for me to put the windows username in the name field for them in case they were the same.
When I do this the name appears selected/highlighted.
I didn't expect this to be the default but it seems to be.
I then use select(0, 0) to remove the selection I didn't want in the first place and try to move the focus down to the password field but it doesn't work.
Can someone tell me if the text being automatically selected is normal and why I can't change focus to the password field.
Yes I'm new to VB.
Private Sub CivilMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
txtUser.Text = (Environment.UserName)
txtUser.Select(0, 0)
txtPassword.Focus()
End Sub
I thought it would be nice, during the form load event, for me to put the windows username in the name field for them in case they were the same.
When I do this the name appears selected/highlighted.
I didn't expect this to be the default but it seems to be.
I then use select(0, 0) to remove the selection I didn't want in the first place and try to move the focus down to the password field but it doesn't work.
Can someone tell me if the text being automatically selected is normal and why I can't change focus to the password field.
Yes I'm new to VB.
Private Sub CivilMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
txtUser.Text = (Environment.UserName)
txtUser.Select(0, 0)
txtPassword.Focus()
End Sub