Solved

RichTextBox caret position

Posted on 2011-03-06
3
1,122 Views
Last Modified: 2012-05-11
hi guys,

im trying to determine the caret position within a RichTextBox. currently im using the .SelectionStart property, however this is causing some problems when there is actually a selection that spans over multiple lines.

i've found the following article talking about a .CaretPosition property, however i cant seem to find how to access this property.

does anyone have any ideas on the most efficient way to handle this?

cheers
0
Comment
Question by:gem56
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Author Comment

by:gem56
ID: 35052435
just to clarify, i have one rtb, i select text across multiple lines, i need to know the caret position.

currently im using the .SelectionStart property, however obviously this doesnt work too well when theres a selection (currently using it when .SelectionLength = 0). im aware i can use SelectionStart + Length to determine the caret position when selecting from left to right, however how do i determine when the selection was made from right to left?

basically looking for an efficient way to handle this.

cheers
0
 
LVL 14

Accepted Solution

by:
robasta earned 500 total points
ID: 35053415
Namespace:  System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)


did you include the reference to this namespace?
0
 

Author Comment

by:gem56
ID: 35063988
...

thanks mate :)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question