Solved

RichTextBox caret position

Posted on 2004-08-28
1
1,042 Views
Last Modified: 2010-05-18
hi

how do i find out what the current position of the caret is in a rich text box? i didn't see any methods. do i have to keep track of how many characters have been entered. seems like a pain in the butt.

thanks p
0
Comment
Question by:pipe
[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
1 Comment
 
LVL 3

Accepted Solution

by:
GrumbleBot earned 100 total points
ID: 11923858
You can use

int n = RichTextBox.SelectionStart

If no text is selected it will return the location within the entire text. It won't return an X,Y type position. If text is selected then it will return the position of the first selected character.

Hope this helps.

Good luck
0

Featured Post

Industry Leaders: 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

Suggested Solutions

Title # Comments Views Activity
What is Microsoft.Exchange.WebServices.Data.ExchangeService in PowerShell? 4 37
Why use this lambda? 12 64
C# Service FileSystemwatcher isse 9 46
C# XML Get Values 4 35
Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…

733 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