Jump to content
  • Advertisement
Sign in to follow this  

[.net] How to update textBox cursor position?

This topic is 3971 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have 2 textBoxes which retrieve text file content, the one is the Source and the other is Destination. Destination is editable but Source is read-only. If I click button Insert, then the selected text from Source will be inserted to the position of active cursor. The question is how to update the cursor position after the insertion? It should moved right after the text inserted. How can I know the last position of the active cursor? Or is there any other way to do this? The insertion part is at the "else" block: Here is my code : if (textBox2->SelectedText != String::Empty) { textBox1->Copy(); textBox2->SelectedText = textBox2->SelectedText->Replace(textBox2->SelectedText,Clipboard::GetText()); textBox2->Focus(); textBox2->Select(textBox2->SelectionStart + Clipboard::GetText()->Length, 0); } else { // INSERTION PART textBox2->Text = textBox2->Text->Insert(textBox2->SelectionStart, textBox1->SelectedText); textBox2->Focus(); textBox2->Select(textBox1->SelectedText->Length - textBox2->SelectionStart,0); } Thank you very much..

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!