There may be a way to cheat, but there is no natural way to do this.
If, for example, at the moment in the application you know that the text in the TextBox selected (no difference left-right or right-left) you can do
textBox1.SelectionLength = 0;
After this line, calling
int caretPosition = textBox1.SelectionStart;
will receive the actual Caret position for you.
By the way, this is a trick, so itβs better to avoid such decisions (maybe someone will suggest something else), and itβs better to slightly change the order of the code.
Hope this helps.
source share