I want to know how when you focus on a textbox in your form, how you get the cursor to go to the first character, instead of the middle/last/etc.
Thank You.
Printable View
I want to know how when you focus on a textbox in your form, how you get the cursor to go to the first character, instead of the middle/last/etc.
Thank You.
use the .selectionstart property
hey vb_2008
use what .paul. has suggested
vb Code:
textbox1.selectionstart=0
to set focus programatically
use this
Quote:
textbox1.focus()
Hey,
.Focus is a lower level method, and shouldn't be used, you should use .Select instead, have a look here:
http://msdn.microsoft.com/en-us/libr...rol.focus.aspx
In particular:
GaryQuote:
Focus is a low-level method intended primarily for custom control authors. Instead, application programmers should use the Select method or the ActiveControl property for child controls, or the Activate method for forms.
Thanks for the replies. Very helpful.
Thanks GEP, i will have to give that a good read. Was only taught the .Focus propety in UNI so i assumed that was the best to use. Good heads up.