Cursor position in TextBox

This is a discussion on Cursor position in TextBox within the C# Programming forums, part of the General Programming Boards category; If I am writing text in a textBox like this. Is it possible to know at what position the cursor ...

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

    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 04:59 PM.

  2. #2
    Registered User
    Join Date
    Dec 2007
    Posts
    383
    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, 05: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, 02: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21