?
Solved

RichTextBox caret position

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

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
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.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

649 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