I built a helpdesk version of a program that would parse out certain information. Now, I am trying to automate it using the same code under a load event and I just can't get it to work. The original code was worked on by .paul. and he did a great job!The original forum is located here.
My Code:
vb.net Code:
Imports System.Text Imports Microsoft.VisualBasic.FileIO Imports System.Collections.ObjectModel Public Class SecurityParser Private Sub SecurityParser_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' Fill textbox1 with the original DEBOUT.TXT ' Dim DeboutTXT As String = My.Settings.DeboutLocation Dim fileContents As String fileContents = My.Computer.FileSystem.ReadAllText(DeboutTXT) TextBox1.Text = fileContents ' Search the contents of the textbox for the keywords ' Dim lines As New List(Of String)(IO.File.ReadAllLines(DeboutTXT)) Dim matches = (From line In lines Where line.contains("Login") Or line.contains("Username") _ Or line.contains("Logout") Or line.contians("rpt") Or line.contains("USERNAME") _ Select "LINE " & lines.IndexOf(line) & ": " & line).toarray If matches Is Nothing OrElse matches.length = 0 Then MsgBox("Nothing found") : Return TextBox2.Lines = matches ' Create the audited file, will be moved by the form1.load event in the background worker ' My.Computer.FileSystem.WriteAllText(My.Settings.XFER_Dir & "AM-AUDIT.TXT", TextBox2.Text, False) End Sub End Class
I am getting one error, which is:
I did not need to call any references for the other program and I am just wondering if I am missing something. Any help is much appreciated.Code:Error 1 Expression of type 'System.Collections.Generic.List(Of String)' is not queryable. Make sure you are not missing an assembly reference and/or namespace import for the LINQ provider. C:\Documents and Settings\mbutler\My Documents\Visual Studio 2008\Projects\Briad Backup\Briad Backup\SecurityParser.vb 20 37 Briad Backup




The original forum is located
Reply With Quote
