V
Vjay77
Hi,
I haven't posted any problem in quite a while now, but I came to the
point that I really need to ask for help.
I need to create an application which will search through .txt log
file and find all lines where email from hotmail occured.
All these emails need to be printed to list box on the form.
Problem with code you'll see below, is that it takes long time to
search through. On just 10mb file it takes almost 2 minutes. And I
need to process 1-2 gb files. Because this is only middle step and
program has much more functionality, I can't afford to wait this
long.
Right now the way I do the search is, that I load each line into
hidden richtextbox and use its find comman to look if there is any
occurence of hotmail.com, and if it is I display the line in listbox.
This process is extremely slow.
How to extract that email address out of the line, that is another
story, does someone know about any good email parser for vb.net?
Can someone look at the code and tell me what I am doing wrong? Why is
is so slow?
Thanks a lot.
vjay
Dim oFile As System.IO.File
Dim oRead As System.IO.StreamReader
Dim linein As String
Dim Result As Integer
Dim count As Integer
oRead = oFile.OpenText(log.txt)
While oRead.Peek <> -1
count = count + 1
linein = oRead.ReadLine()
RichTextBox1.Text = linein
'StatusBar1.Text = count.ToString
Result = RichTextBox1.Find("hotmail.com",
RichTextBoxFinds.MatchCase)
If Result <> -1 Then
ListBox2.Items.Add(linein)
End If
End While
oRead.Close()
I haven't posted any problem in quite a while now, but I came to the
point that I really need to ask for help.
I need to create an application which will search through .txt log
file and find all lines where email from hotmail occured.
All these emails need to be printed to list box on the form.
Problem with code you'll see below, is that it takes long time to
search through. On just 10mb file it takes almost 2 minutes. And I
need to process 1-2 gb files. Because this is only middle step and
program has much more functionality, I can't afford to wait this
long.
Right now the way I do the search is, that I load each line into
hidden richtextbox and use its find comman to look if there is any
occurence of hotmail.com, and if it is I display the line in listbox.
This process is extremely slow.
How to extract that email address out of the line, that is another
story, does someone know about any good email parser for vb.net?
Can someone look at the code and tell me what I am doing wrong? Why is
is so slow?
Thanks a lot.
vjay
Dim oFile As System.IO.File
Dim oRead As System.IO.StreamReader
Dim linein As String
Dim Result As Integer
Dim count As Integer
oRead = oFile.OpenText(log.txt)
While oRead.Peek <> -1
count = count + 1
linein = oRead.ReadLine()
RichTextBox1.Text = linein
'StatusBar1.Text = count.ToString
Result = RichTextBox1.Find("hotmail.com",
RichTextBoxFinds.MatchCase)
If Result <> -1 Then
ListBox2.Items.Add(linein)
End If
End While
oRead.Close()