Jump to content


Photo

Caret position in TextBox in C#

- - - - -

  • Please log in to reply
1 reply to this topic

#1
Petyas

Petyas

    Newbie

  • Members
  • Pip
  • 14 posts
  • Devices:Motorola MPX 220
How is it possible to get a caret position (row,collumn or current char position in string) in textbox control. TextBox have a method Select(position, length), but how can i obtain current position? If isn't way in C#, exists some method what i can import from any DLL? I found only method GetCaretPosition from coredll.dll. This method returns x, y position of caret, but this method i cannot use, because every char has a different width. This i need for select, cut, copy and paste.

Any idea?

Thanks

  • 0

#2
GregBlast

GregBlast

    Newbie

  • Members
  • Pip
  • 1 posts
  • Devices:/
It is "TextBox.SelectionStart". You can either get it and set it.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users