Solved

RichTextBox caret position

Posted on 2011-03-06
3
1,125 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

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

726 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