Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: .NET3.5 VS2008 C# VB.NET
can anybody please provide me a code to demonstrate how we can locate the position of the currently selected text (any position, middle, left or right) in a richtextbox control??
 
i need to show a listbox at the position with some synonyms option. the listbox is invisible at start of application. only when user selects a word from richtextbox should the listbox be shown at the current selected text location.
Posted 30-Jul-10 6:20am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

This article[^] might help you find the x,y point. If not try these google results.[^]
  Permalink  
Comments
amitupadhyay007353543543 at 30-Jul-10 13:24pm
   
my apologies for rude behaviour. thanks for your help. (i tried searching by the topic of this question)
amitupadhyay007353543543 at 30-Jul-10 13:24pm
   
Reason for my vote of 5
very helpful
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You should try to google your questions before posting.
Dim intPosition as Integer = txtRichtextbox.SelectionStart
 

but it sounds like you reall just want the selected text:
Dim strSelectedText as String = txtRichtextbox.SelectedText
  Permalink  
Comments
Kschuler at 30-Jul-10 13:17pm
   
Yes I read what you wanted. You said position, not point. I gave you the position. You should update your question and be more specific.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 6,651
1 Sergey Alexandrovich Kryukov 6,400
2 CPallini 5,230
3 George Jonsson 3,574
4 Gihan Liyanage 2,542


Advertise | Privacy | Mobile
Web01 | 2.8.140921.1 | Last Updated 29 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100