InputPanel vs TextBox.SelectAll()

Z

Zanna

Hi,

Why this code doesn't work

Private Sub txtCliente_GotFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles txtCliente.GotFocus
InputPanel1.Enabled = True
DirectCast(sender, TextBox).SelectAll()
End Sub

I can see the SelectAll() "flashing" but it doesn't still active...

Thanks
 
M

marcmc

i have just tested this, the sip pops up, what is the
problem or what do you want the program to do?

Private Sub TextBox2_GotFocus(ByVal sender As Object,
ByVal e As System.EventArgs) Handles TextBox2.GotFocus
InputPanel1.Enabled = True
DirectCast(sender, TextBox).SelectAll()
End Sub
 
Z

Zanna

marcmc said:
i have just tested this, the sip pops up, what is the
problem or what do you want the program to do?

Private Sub TextBox2_GotFocus(ByVal sender As Object,
ByVal e As System.EventArgs) Handles TextBox2.GotFocus
InputPanel1.Enabled = True
DirectCast(sender, TextBox).SelectAll()
End Sub

I don't have the TextBox2 get selected.

Bye
 
A

Alex Feinman [MVP]

The click which causes TextBox to come into focus is processed *after* the
Focus event is sent. Correspondingly your SelectAll is reset. Very
annoying - the workaround would be to set a short timer in GotFocus and do
SelectAll on timer (and immediately disable timer after that)
 
Z

Zanna

Alex said:
The click which causes TextBox to come into focus is processed *after* the
Focus event is sent. Correspondingly your SelectAll is reset. Very
annoying - the workaround would be to set a short timer in GotFocus and do
SelectAll on timer (and immediately disable timer after that)


And there is no way to "pick" the click message and throw it away before
the SelectAll()?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top