Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more: , +
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

This article[^] might help you find the x,y point. If not try these google results.[^]
 
Share this answer
 
Comments
amit_upadhyay 30-Jul-10 13:24pm    
my apologies for rude behaviour. thanks for your help. (i tried searching by the topic of this question)
amit_upadhyay 30-Jul-10 13:24pm    
Reason for my vote of 5
very helpful
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
 
Share this answer
 
Comments
Kschuler 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900