top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

how to set the “|” character to last position in textBox?

+2 votes
227 views

Hi i am little bit struct in this concept in my textbox i am using substring concept text length exceed means it select particular it works fine but my cursor move first after my substring.

posted Nov 13, 2014 by Saravanan

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

I think this is your issue
for example:

123 | a <- invalid character, my function in the _TextChanged event remove it and the position go to:

| 123

I want:

123 |

The following code will help you to solve your problem

int textLength = yourTextBox.Text.Length;
yourTextBox.SelectionStart = textLength;
yourTextBox.SelectionLength = 0;

answer Nov 17, 2014 by Jdk
...