Click here to Skip to main content
Rate this: bad
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 7:20am
Rate this: bad
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.[^]
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
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
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 Dnyaneshwar@Pune 719
1 CHill60 315
2 Sergey Alexandrovich Kryukov 240
3 TheRealSteveJudge 190
4 Peter Leow 160
0 Sergey Alexandrovich Kryukov 9,193
1 OriginalGriff 6,786
2 Peter Leow 4,332
3 Zoltán Zörgő 3,809
4 Richard MacCutchan 2,672

Advertise | Privacy | Mobile
Web03 | 2.8.150128.1 | Last Updated 29 Dec 2012
Copyright © CodeProject, 1999-2015
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