views:

30

answers:

1

When I select an item on my Listbox, a Textbox is filled with the selected text for editing. How can I get the cursor to focus on the Textbox text so I don't have to click on it with my mouse before editing?

+1  A: 

Just use the Control's Focus method:

TextBox1.Text = selectedItemText;    
TextBox1.Focus();

Or

TextBox1.Select();

Or if you just want to put a cursor after the last letter in the TextBox:

TextBox1.Select(TextBox1.Text.Length, 0);
TextBox1.Focus();
GenericTypeTea
@GenericTypeTea: It works, thanks!
D. Veloper