how to search richtextbox for a certain word?

i need to search the richtextbox for a 7 catogories each one contain 2

Page 1 of 1

5 Replies - 10069 Views - Last Post: 09 August 2009 - 01:33 AM Rate Topic: -----

#1 wdaffa   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 03-August 09

how to search richtextbox for a certain word?

Post icon  Posted 03 August 2009 - 01:47 AM

how to search richtextbox for a certain word?
Is This A Good Question/Topic? 0
  • +

Replies To: how to search richtextbox for a certain word?

#2 janne_panne   User is offline

  • WinRT Dev
  • member icon

Reputation: 428
  • View blog
  • Posts: 1,047
  • Joined: 09-June 09

Re: how to search richtextbox for a certain word?

Posted 03 August 2009 - 01:59 AM

Use ricthtextbox.Text property to get the text inside the control. Then search a word like in any string.

For example:

	Dim rtb As New RichTextBox()
	Dim text As String = rtb.Text
	If text.Contains("my category") Then
	  ' do something '
	End If


Was This Post Helpful? 0
  • +
  • -

#3 wdaffa   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 03-August 09

Re: how to search richtextbox for a certain word?

Posted 08 August 2009 - 02:11 AM

View Postjanne_panne, on 3 Aug, 2009 - 12:59 AM, said:

Use ricthtextbox.Text property to get the text inside the control. Then search a word like in any string.

For example:

	Dim rtb As New RichTextBox()
	Dim text As String = rtb.Text
	If text.Contains("my category") Then
	  ' do something '
	End If


the problem its a the word iam searching for not something i know
i have a string contain a certain word then i have to read in the richtextbox to mach the word if it's equal to the string then i have to count it (counter) and so on untill i finish the hundred string i have
Was This Post Helpful? 0
  • +
  • -

#4 modernic2008   User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 63
  • Joined: 25-October 07

Re: how to search richtextbox for a certain word?

Posted 08 August 2009 - 04:28 PM

View Postwdaffa, on 8 Aug, 2009 - 01:11 AM, said:

View Postjanne_panne, on 3 Aug, 2009 - 12:59 AM, said:

Use ricthtextbox.Text property to get the text inside the control. Then search a word like in any string.

For example:

	Dim rtb As New RichTextBox()
	Dim text As String = rtb.Text
	If text.Contains("my category") Then
	  ' do something '
	End If


the problem its a the word iam searching for not something i know
i have a string contain a certain word then i have to read in the richtextbox to mach the word if it's equal to the string then i have to count it (counter) and so on untill i finish the hundred string i have

Aha... well, if I got what you want to say, then the solution is simple: "my category" doesn't have to be directly stated, you can declare a variable named categoryOfMine and assign it the value "my category" then change the parameter of the Cotains function into categoryOfMine. As for counting them, just use a loop with the IndexOf function. The code looks pretty much nothing but awkward, but it should work... theoritically at least. As for the 100 strings, did I miss something there? "THE" is a definite article, it requires that both the speaker (you) and the one he's speaking to (me) know what is meant by the word after it... the latter is missing here. I could do with some more explanation.
Was This Post Helpful? 0
  • +
  • -

#5 PsychoCoder   User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1659
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: how to search richtextbox for a certain word?

Posted 08 August 2009 - 05:25 PM

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Post your code like this: :code:

Thanks.
Was This Post Helpful? 0
  • +
  • -

#6 wdaffa   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 03-August 09

Re: how to search richtextbox for a certain word?

Posted 09 August 2009 - 01:33 AM

View Postmodernic2008, on 8 Aug, 2009 - 03:28 PM, said:

View Postwdaffa, on 8 Aug, 2009 - 01:11 AM, said:

View Postjanne_panne, on 3 Aug, 2009 - 12:59 AM, said:

Use ricthtextbox.Text property to get the text inside the control. Then search a word like in any string.

For example:

	Dim rtb As New RichTextBox()
	Dim text As String = rtb.Text
	If text.Contains("my category") Then
	  ' do something '
	End If


the problem its a the word iam searching for not something i know
i have a string contain a certain word then i have to read in the richtextbox to mach the word if it's equal to the string then i have to count it (counter) and so on untill i finish the hundred string i have

Aha... well, if I got what you want to say, then the solution is simple: "my category" doesn't have to be directly stated, you can declare a variable named categoryOfMine and assign it the value "my category" then change the parameter of the Cotains function into categoryOfMine. As for counting them, just use a loop with the IndexOf function. The code looks pretty much nothing but awkward, but it should work... theoritically at least. As for the 100 strings, did I miss something there? "THE" is a definite article, it requires that both the speaker (you) and the one he's speaking to (me) know what is meant by the word after it... the latter is missing here. I could do with some more explanation.

thanks for making fun of me
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1