Focus problem

M

Michael Wong

On the form, I have a textbox in which users provide information to filter a
datagrid.
The problem I have is when I move around (horizontally and vertically) in
the datagrid,
the textbox seems to receive focus and repaints itself before focusing back
to the datagrid.

The only workaround I found is to have Tabstop = False for the textbox, but
then I cannot have
it initially focused when the form displays for the first time.

I tried setting the focus to the textbox in the form constructor and in the
form load event but
both doesn't work: Focus() returned false.

What have I done wrong?
 
M

Michael Wong

Ok, I found a solution from a previous search in Google:

myTextBox.Select();
 

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

Similar Threads


Top