Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,

I am getting trouble in sentence selection in vb.net.
What I want to is that, I put the text into the main text area and when I click on next button ">>" it will select the next sentence and so on.... Same for the previous button it will select the previous sentence. Please consider the DOT (.) as the sentence stopper.

Please help me ASAP.

Thanks to All.


Regards
Kapil
Posted

Rather than provide code I am going to make a suggestion. It is better to learn by doing than by copying.

Use the Find() and FindNext() to locate the periods, Then select the text

Here are the RichTextBox Methods. Lots of cool stuff that you can use.
http://msdn.microsoft.com/en-us/library/system.windows.forms.richtextbox_methods.aspx[^]

Some Sample code, just in case.
http://www.dotnetcurry.com/ShowArticle.aspx?ID=146[^]

And good stuff right here in CP:
http://www.codeproject.com/search.aspx?q=Search+and+Highlight+Text+in+a+RichTextBox&sbo=kw[^]

Regards
 
Share this answer
 
Comments
RaviRanjanKr 1-Jul-11 10:51am    
Nice Links! My 5 :)
S Houghtelin 1-Jul-11 10:52am    
Thank you, and thanks for the upvote :)
Prasanta_Prince 1-Jul-11 11:23am    
Good one..
S Houghtelin 1-Jul-11 11:25am    
Thank you :)
<br />
RichTextBox rtb = new RichTextBox();<br />
TextRange tr = new TextRange(rtb.Document.ContentStart, rtb.Document.ContentEnd);<br />
tr.Select(rtb.Document.Blocks.FirstBlock.ContentStart, rtb.Document.Blocks.FirstBlock.ContentEnd);<br />


see other links
Link1[^]
Link2[^]
 
Share this answer
 

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