I recently made a program for searching logs... Though It works, but I'm trying to make it faster.... hopefully you guys can enlighten me.

VB Code:
  1. Private Sub btSearch_Click()
  2. Dim Count As Integer
  3. Dim Results As String
  4. Dim i As Integer
  5. Dim OneFile As String
  6.  
  7. DisableControls
  8. LoadWordList
  9. ProgressBar1.Value = 0
  10.  
  11. If Option1.Value = True Then
  12.     FindInText "", tbContent.Text, Count, Results
  13. Else
  14.     ProgressBar1.Visible = True
  15.     For i = 1 To AllFiles.Count
  16.         On Error Resume Next
  17.         Open AllFiles.Item(i) For Input As #1
  18.         OneFile = Input(LOF(1), #1)
  19.         FindInText AllFiles.Item(i) & vbTab & ":", OneFile, Count, Results
  20.         Close #1
  21.         Dim NewValue As Integer
  22.         NewValue = ProgressBar1.Value + ((FileLen(AllFiles.Item(i)) / 10) / AllFilesSize) * 100
  23.         If NewValue < 100 Then
  24.             ProgressBar1.Value = ProgressBar1.Value + ((FileLen(AllFiles.Item(i)) / 10) / AllFilesSize) * 100
  25.         Else
  26.             ProgressBar1.Value = 100
  27.         End If
  28.     Next
  29.     ProgressBar1.Visible = False
  30. End If
  31.  
  32. Form3.tbCount.Text = Count
  33. Form3.tbResults.Text = Results
  34.  
  35. EnableControls
  36.  
  37. Form3.Show
  38. End Sub
  39.  
  40. Private Sub FindInText(Label As String, Text As String, ByRef Count As Integer, ByRef Results As String)
  41. Dim StartIndex, EndIndex, i As Integer
  42. Dim Sentence As String
  43.  
  44. EndIndex = 0
  45.  
  46. While EndIndex < Len(Text)
  47.     StartIndex = EndIndex + 1
  48.     EndIndex = InStr(StartIndex, Text, vbLf, vbTextCompare)
  49.     If EndIndex = 0 Then
  50.         Sentence = Mid(Text, StartIndex)
  51.         EndIndex = Len(Text)
  52.     Else
  53.         Sentence = Mid(Text, StartIndex, EndIndex - StartIndex - 1)
  54.     End If
  55.    
  56.     For i = 0 To Form2.lbWords.ListCount - 1
  57.         If InStr(1, Sentence, Form2.lbWords.List(i), vbTextCompare) > 0 Then
  58.             Results = Results + Label + Sentence + vbCrLf
  59.             Count = Count + 1
  60.         End If
  61.     Next
  62. Wend
  63.  
  64. End Sub