?
Solved

RichTextBox caret position

Posted on 2011-03-06
3
Medium Priority
?
1,130 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 2000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month11 days, 13 hours left to enroll

752 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