End of Text in RichTextbox

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Jun 2009
Posts: 33
Reputation: vishalonne is an unknown quantity at this point 
Solved Threads: 0
vishalonne vishalonne is offline Offline
Light Poster

End of Text in RichTextbox

 
0
  #1
Jul 14th, 2009
Dear Friend

How can I check end of the text in rich text box using C#?
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 2,052
Reputation: serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light 
Solved Threads: 121
Featured Poster
serkan sendur serkan sendur is offline Offline
Postaholic

Re: End of Text in RichTextbox

 
0
  #2
Jul 14th, 2009
i dont understand your question.
Due to lack of freedom of speech, i no longer post on this website.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: End of Text in RichTextbox

 
0
  #3
Jul 14th, 2009
Neither me..
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 2,052
Reputation: serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light 
Solved Threads: 121
Featured Poster
serkan sendur serkan sendur is offline Offline
Postaholic

Re: End of Text in RichTextbox

 
0
  #4
Jul 14th, 2009
no not again
ddanbe,sknake, adatapost and others will be added to list soon
Due to lack of freedom of speech, i no longer post on this website.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 33
Reputation: vishalonne is an unknown quantity at this point 
Solved Threads: 0
vishalonne vishalonne is offline Offline
Light Poster

Re: End of Text in RichTextbox

 
0
  #5
Jul 17th, 2009
I have one richtext box in my windows application and wrote few lines in that richtext box say - 7 lines
Now I want to read all the text of richtext box word by word and want to search particular word in those text.
I know there is find() in C# but I don't want to use that.

I hope now I am clear to every body
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 64
Reputation: lighthead is on a distinguished road 
Solved Threads: 15
lighthead's Avatar
lighthead lighthead is offline Offline
Junior Poster in Training

Re: End of Text in RichTextbox

 
0
  #6
Jul 17th, 2009
You can copy the text from the RichTextBox into a String and search it using IndexOf method.
Everybody Lies.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: End of Text in RichTextbox

 
1
  #7
Jul 17th, 2009
To get word by word then search on specific word
  1. int GetWordIndex(string word)
  2. {
  3. char[] splitters = new char[]{' '};
  4. string[] wordsArr = RichTextBox1.Text.Split(splitters, StringSplitOptions.RemoveEmptyEntries);
  5. for(int i=0; i< wordsArr.Length; i++)
  6. if(string.Equals(wordsArr[i], word, StringComparison.InvariantCultureIgnoreCase))
  7. return i;
  8. return -1; //indicates there is no match
  9. }
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,346
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 603
Sponsor
sknake's Avatar
sknake sknake is offline Offline
.NET Enthusiast

Re: End of Text in RichTextbox

 
0
  #8
Jul 17th, 2009
What do you want to use?

  1. private void button1_Click(object sender, EventArgs e)
  2. {
  3. string find = "blu";
  4. if (0 <= richTextBox1.Text.IndexOf(find, StringComparison.InvariantCultureIgnoreCase))
  5. {
  6. System.Diagnostics.Debugger.Break();
  7. //found
  8. }
  9. else
  10. {
  11. // not found
  12. }
  13. }
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,346
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 603
Sponsor
sknake's Avatar
sknake sknake is offline Offline
.NET Enthusiast

Re: End of Text in RichTextbox

 
0
  #9
Jul 17th, 2009
Originally Posted by Ramy Mahrous View Post
To get word by word then search on specific word
  1. int GetWordIndex(string word)
  2. {
  3. char[] splitters = new char[]{' '};
  4. string[] wordsArr = RichTextBox1.Text.Split(splitters, StringSplitOptions.RemoveEmptyEntries);
  5. for(int i=0; i< wordsArr.Length; i++)
  6. if(string.Equals(wordsArr[i], word, StringComparison.InvariantCultureIgnoreCase))
  7. return i;
  8. return -1; //indicates there is no match
  9. }
You can also use RegEx's word boundary so you can handle splitting and removing punctuation:
  1. private void button2_Click(object sender, EventArgs e)
  2. {
  3. string input = richTextBox1.Text;
  4. string[] words = System.Text.RegularExpressions.Regex.Split(input, @"\W+", System.Text.RegularExpressions.RegexOptions.Multiline);
  5. }
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: End of Text in RichTextbox

 
0
  #10
Jul 17th, 2009
He can also add in splitters what you need
It may be also array of string to have something like that ("\r\n") if you read from text files.
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C#
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC