TextBox
-
Does anyone know how to add text to a TextBox programaticaly without the cursor jumping to the beginning of the text? Thanks. avivhal
-
Does anyone know how to add text to a TextBox programaticaly without the cursor jumping to the beginning of the text? Thanks. avivhal
If you take a look at the documentation for the
TextBox
control you should notice aSelectionStart
. Set that toTextBox.Text.Length - 1
to set the insertion point at the end of the text. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles] [My Blog] -
If you take a look at the documentation for the
TextBox
control you should notice aSelectionStart
. Set that toTextBox.Text.Length - 1
to set the insertion point at the end of the text. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles] [My Blog]I want to insert the text programaticaly. I am developing for a PDA using the .NET compact framwork. Everytiem I add data programaticaly as follows: textBoxTerminal.Text += (string)str; textBoxTerminal.SelectionStart = textBoxTerminal.Text.Length; textBoxTerminal.ScrollToCaret(); the cursor jumps to the beginning of the text and then jumps to the end. How can I avoid this jump to the beginning of the text before I set the caret position? Thanks. avivhal
-
I want to insert the text programaticaly. I am developing for a PDA using the .NET compact framwork. Everytiem I add data programaticaly as follows: textBoxTerminal.Text += (string)str; textBoxTerminal.SelectionStart = textBoxTerminal.Text.Length; textBoxTerminal.ScrollToCaret(); the cursor jumps to the beginning of the text and then jumps to the end. How can I avoid this jump to the beginning of the text before I set the caret position? Thanks. avivhal
The fact that you're targeting the .NET CF is something you should've mentioned up-front. We can't help you if you don't give us all the necessary details. The other poster could've avoiding posting about the
Append
method if he/she knew that you were targeting .NET CF (and either knew off-hand that it wasn't available or bothered to check the documentation before giving faulty information). Look for my answer on the other responses. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles] [My Blog]