0

Is it possible to get the cursor position in any way in a textBox and also set a Cursorpositon.

I have tried out this syntax but am not sure if this is correct:
I dont know what this returns.

textBox1->Cursor->Position::get();
textBox1->Cursor->Position::set();
2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by Jennifer84
0

You can use the SelectionStart TextBox's property for that purpose.
Also closely related is the SelectionLength i.e. how many characters the selection spans (if any).
As an example, to place the cursor in front of the second character without selected text, you could use

textBox1->SelectionStart = 1;
textBox1->SelectionLength = 0;
0

Thanks, this seemed to work great.

You can use the SelectionStart TextBox's property for that purpose.
Also closely related is the SelectionLength i.e. how many characters the selection spans (if any).
As an example, to place the cursor in front of the second character without selected text, you could use

textBox1->SelectionStart = 1;
textBox1->SelectionLength = 0;
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.