Thread: Cursor position in TextBox

  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    385

    Cursor position in TextBox

    If I am writing text in a textBox like this.
    Is it possible to know at what position the cursor is at the moment you are writing.
    To put this code in the textBox event handler.

    As for the word "Hello" the cursor at the letter "o" is at Line 9 and postion 5 on that line.

    Hello


    What could be interesting is also just if it is for example possible to put the cursor at:

    Line 9 and position 5
    Last edited by Coding; 03-19-2008 at 03:59 PM.

  2. #2
    Registered User
    Join Date
    Dec 2007
    Posts
    385
    I found a solution with this syntax:

    Code:
    this->textBox1->SelectionStart = 1;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 04-02-2009, 04:40 AM
  2. Replies: 5
    Last Post: 03-02-2009, 08:33 AM
  3. Problem with a multiline textbox
    By Zeokat in forum C# Programming
    Replies: 4
    Last Post: 10-24-2008, 01:14 PM
  4. inserting text in a textbox
    By Rune Hunter in forum C# Programming
    Replies: 1
    Last Post: 01-07-2006, 05:32 PM
  5. How would I add a textbox?
    By -KEN- in forum C# Programming
    Replies: 2
    Last Post: 11-13-2001, 02:02 PM