Solved

RichTextBox caret position

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now