Click here to Skip to main content
15,911,139 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear friends,

Good morning..

i am developing window application.in that i have richtextbox for getting paragraph content and another textbox for getting keyword content.based on the keyword i need to search in paragraph without considering the case.Because if the keyword is in title case it will not find the word in paragraph.


so can anyone solve my problem?
.i just append my code.plz review on that.

Dim len As Integer = para.Length
Dim index As Integer = 0
Dim lastIndex As Integer = para.LastIndexOf(LCase(word))
While index < lastIndex
RTBtext.Find(word, index, len, RichTextBoxFinds.MatchCase)
RTBtext.SelectionColor = Drawing.Color.Green
index = para.IndexOf(word, index) + 1
End While

str = para.Split(". ")

For i As Integer = 0 To UBound(str)
If str(i).Contains(word) Or str(i).Contains(LCase(word)) Then
RTBabstract.Text = str(i)
Dim len1 As Integer = para.Length
Dim index1 As Integer = 0
Dim lastIndex1 As Integer = para.LastIndexOf(RTBabstract.Text)
'If count = 1 Then
' Exit Sub
'End If
While index1 < lastIndex1
''If count = 0 Then
RTBtext.Find(RTBabstract.Text, index1, len1, RichTextBoxFinds.MatchCase)
RTBtext.SelectionBackColor = Drawing.Color.Yellow
index1 = para.IndexOf(RTBabstract.Text, index1) + 1
count = 1
'End If
End While
End If
Next


in the code,when i find the last index it does not calculte the index because of case problem.

Thanks in advance
Posted
Updated 26-Feb-13 20:12pm
v2

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