Hi,
In the visual studio options->text editor->basic uncheck the hide
advanced members check box. The code you are using set the focus to the
first textbox then sets the focus to the second textbox. Actually since you
are clicking on a button to add to textbox the button has the focus. Try
something like this
Dim bPassword As Boolean = False
Private Sub txtUser_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles txtUser.TextChanged
bPassword = False
End Sub
Private Sub txtPassword_TextChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles txtPassword.TextChanged
bPassword = True
End Sub
Private Sub Q_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Q.Click, W.Click, E.Click, R.Click, T.Click,
Y.Click............rest of them
If bPassword Then
txtUser.Text = txtUser.Text & UCase(CType(sender, Button).Text)
Else
txtPass.Text = txtPass.Text & UCase(CType(sender, Button).Text)
End if
End Sub
Ken
----------------------------
"buc" <bu******@hotmail.com> wrote in message
news:eE*************@TK2MSFTNGP10.phx.gbl...
According to MSDN .focus sets focus OR returns a true/false as to
whether a control has focus or not. Im am simply checking what textbox
currently has focus to know where to put the alphabetic letter that they
user just pressed. I can't figure out why this code is failing, How can 2
controls have focus at the same time.? Event if I do a a txtUser.Focus(),
which actually sets focus, it code still returns that both have focus.. Any
ideas... I couldn't find a FOCUSED command..
"buc" <bu******@hotmail.com> wrote in message
news:OS**************@TK2MSFTNGP11.phx.gbl...
I have created a simple login keyboard with QWERTY keys with a user textbox
and password textbox. When I press a key the text goes into both boxes....?
The focus event on both boxes eval to TRUE. Why? this is driving me nuts,
must be a simple answer. Here's code
I named each letter button its own letter (The 'A' button is named
A..Etc.)
I shortened the A.Click, B.click code handles for this post because there
were 26 of them.
Private Sub Q_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Q.Click, W.Click, E.Click, R.Click, T.Click,
Y.Click............rest of them
If txtUser.Focus = True Then txtUser.Text = txtUser.Text &
UCase(CType(sender, Button).Text)
If txtPass.Focus = True Then txtPass.Text = txtPass.Text &
UCase(CType(sender, Button).Text)
End Sub
The letter is put in both boxes, and even the DEBUGGER says both focuses
are true?? This is the only code in my program right now..
Any Ideas?..... Thanks BUC