Find Method 2,0 VB.Net

  • Thread starter Thread starter J0hnny09
  • Start date Start date
J

J0hnny09

Guest
Hi all I just wanna try this is it possible to make find Button and then make another Button for Tracing, Because I have a log that has error encountered during order transaction.

I wanna search the error and then trace the timestamp of Order Start that the Error occur

See bold text below:


------------9/03/20 10:00:00-------------
=============Order Start=================
10:00 AM Order Created
10:01 AM Order Canceled
------------9/03/20 10:10:00-------------
=============Order Start=================
10:10 AM Order Created
10:11 AM Order Successfull


------------9/03/20 10:20:00-------------
=============Order Start=================
10:20 AM Order Created
10:21 AM Order Cancelled..
10:22 AM ***ERROR DURING TRANSACTION



I will use this code for Find Button:

Try
Dim find As String = TextBox1.Text

RichTextBox1.Focus()
If setPos.Contains(findPos) Then
If Not index - 1 < 0 Then
index -= 1
End If
findPos += TextBox1.Text.Length
findPos = RichTextBox1.Find(find, findPos, RichTextBoxFinds.None)


If Not setPos.Contains(findPos) Then
setPos.Add(findPos)
End If
RichTextBox1.[Select](findPos, find.Length)

Else
findPos = RichTextBox2.Find(find, findPos, RichTextBoxFinds.None)
setPos.Add(findPos)
RichTextBox1.[Select](findPos, find.Length)
findPos += TextBox1.Text.Length
End If
Catch
MessageBox.Show("No Matched text Found")
findPos = 0
setPos.Clear()

End Try

Hoping for your kind support.

Best Regards,

J0hnny09

Continue reading...
 
Back
Top