Results 1 to 11 of 11

Thread: [RESOLVED] Parsing/Copying Strings

  1. #1

    Thread Starter
    Hyperactive Member mbutler755's Avatar
    Join Date
    May 2008
    Location
    Peoria, AZ
    Posts
    417

    Resolved [RESOLVED] Parsing/Copying Strings

    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:
    1. Imports System.Text
    2. Imports Microsoft.VisualBasic.FileIO
    3. Imports System.Collections.ObjectModel
    4.  
    5.  
    6. Public Class SecurityParser
    7.  
    8.     Private Sub SecurityParser_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    9.  
    10.         ' Fill textbox1 with the original DEBOUT.TXT
    11.         '
    12.         Dim DeboutTXT As String = My.Settings.DeboutLocation
    13.         Dim fileContents As String
    14.         fileContents = My.Computer.FileSystem.ReadAllText(DeboutTXT)
    15.         TextBox1.Text = fileContents
    16.  
    17.         ' Search the contents of the textbox for the keywords
    18.         '
    19.         Dim lines As New List(Of String)(IO.File.ReadAllLines(DeboutTXT))
    20.         Dim matches = (From line In lines Where line.contains("Login") Or line.contains("Username") _
    21.                      Or line.contains("Logout") Or line.contians("rpt") Or line.contains("USERNAME") _
    22.                      Select "LINE " & lines.IndexOf(line) & ": " & line).toarray
    23.  
    24.         If matches Is Nothing OrElse matches.length = 0 Then MsgBox("Nothing found") : Return
    25.         TextBox2.Lines = matches
    26.  
    27.         ' Create the audited file, will be moved by the form1.load event in the background worker
    28.         '
    29.         My.Computer.FileSystem.WriteAllText(My.Settings.XFER_Dir & "AM-AUDIT.TXT", TextBox2.Text, False)
    30.  
    31.     End Sub
    32. End Class

    I am getting one error, which is:
    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
    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.
    Regards,

    Matt Butler, MBA, BSIT/SE, MCBP
    Owner, Intense IT, LLC
    Find us on Facebook
    Follow us on Twitter
    Link up on LinkedIn
    mb (at) i2t.us

    CODE BANK SUBMISSIONS: Converting Images to Base64 and Back Again

  2. #2
    Member
    Join Date
    Apr 2010
    Posts
    52

    Re: Parsing/Copying Strings

    Ignore, I got that wrong
    Last edited by dotalchemy; Apr 29th, 2010 at 11:16 AM. Reason: Ignore, I got that wrong :(

  3. #3
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,413

    Re: Parsing/Copying Strings

    if vs says it needs a reference, it won't work without it.
    some references are added as default depending on the target framework + if you compare references in the 2 projects you'll probably see the problem

  4. #4

    Thread Starter
    Hyperactive Member mbutler755's Avatar
    Join Date
    May 2008
    Location
    Peoria, AZ
    Posts
    417

    Re: Parsing/Copying Strings

    .paul.,

    I have checked all the references. I had to change the default framework from 3.0 to 3.5. I now match the other program, but the issue persists. I have attached an image.

    Code:
    Old References -> References from the other program
    New References -> References on the new program
    Attached Images Attached Images  
    Last edited by mbutler755; Apr 29th, 2010 at 01:14 PM. Reason: now; not know
    Regards,

    Matt Butler, MBA, BSIT/SE, MCBP
    Owner, Intense IT, LLC
    Find us on Facebook
    Follow us on Twitter
    Link up on LinkedIn
    mb (at) i2t.us

    CODE BANK SUBMISSIONS: Converting Images to Base64 and Back Again

  5. #5
    Fanatic Member stlaural's Avatar
    Join Date
    Sep 2007
    Location
    Quebec, Canada
    Posts
    683

    Re: Parsing/Copying Strings

    Just to be sure, don't you need to Import System.LINQ in order to perform Queries on your objects ?
    I saw you have System.XML.Linq in your references but... I don't know... I always import it to be sure.
    Alex
    .NET developer
    "No. Not even in the face of Armageddon. Never compromise." (Walter Kovacs/Rorschach)

    Things to consider before posting.
    Don't forget to rate the posts if they helped and mark thread as resolved when they are.


    .Net Regex Syntax (Scripting) | .Net Regex Language Element | .Net Regex Class | DateTime format | Framework 4.0: what's new
    My fresh new blog : writingthecode, even if I don't post much.

    System: Intel i7 920, Kingston SSDNow V100 64gig, HDD WD Caviar Black 1TB, External WD "My Book" 500GB, XFX Radeon 4890 XT 1GB, 12 GBs Tri-Channel RAM, 1x27" and 1x23" LCDs, Windows 10 x64, ]VS2015, Framework 3.5 and 4.0

  6. #6
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Parsing/Copying Strings

    LINQ is part of the 3.5FW... so it won't work against the 3.0FW.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  7. #7
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,413

    Re: Parsing/Copying Strings

    you're missing a system.core reference there too

  8. #8

    Thread Starter
    Hyperactive Member mbutler755's Avatar
    Join Date
    May 2008
    Location
    Peoria, AZ
    Posts
    417

    Re: Parsing/Copying Strings

    Quote Originally Posted by stlaural View Post
    Just to be sure, don't you need to Import System.LINQ in order to perform Queries on your objects ?
    I saw you have System.XML.Linq in your references but... I don't know... I always import it to be sure.
    I do not have a System.LINQ reference available. It goes straight from System.IO.Log to System.Management. Why would the other program work without this reference if it were required?
    Last edited by mbutler755; Apr 30th, 2010 at 08:22 AM. Reason: add more text
    Regards,

    Matt Butler, MBA, BSIT/SE, MCBP
    Owner, Intense IT, LLC
    Find us on Facebook
    Follow us on Twitter
    Link up on LinkedIn
    mb (at) i2t.us

    CODE BANK SUBMISSIONS: Converting Images to Base64 and Back Again

  9. #9

    Thread Starter
    Hyperactive Member mbutler755's Avatar
    Join Date
    May 2008
    Location
    Peoria, AZ
    Posts
    417

    Re: Parsing/Copying Strings

    Quote Originally Posted by .paul. View Post
    you're missing a system.core reference there too
    Adding System.Core could not be added. This component is already automatically referenced by the build system.
    Regards,

    Matt Butler, MBA, BSIT/SE, MCBP
    Owner, Intense IT, LLC
    Find us on Facebook
    Follow us on Twitter
    Link up on LinkedIn
    mb (at) i2t.us

    CODE BANK SUBMISSIONS: Converting Images to Base64 and Back Again

  10. #10

    Thread Starter
    Hyperactive Member mbutler755's Avatar
    Join Date
    May 2008
    Location
    Peoria, AZ
    Posts
    417

    Re: Parsing/Copying Strings

    Interesting. I added the reference to System.LINQ to the page itself:

    vb Code:
    1. Imports System.Linq

    And it works now. Thanks stlaural!
    Regards,

    Matt Butler, MBA, BSIT/SE, MCBP
    Owner, Intense IT, LLC
    Find us on Facebook
    Follow us on Twitter
    Link up on LinkedIn
    mb (at) i2t.us

    CODE BANK SUBMISSIONS: Converting Images to Base64 and Back Again

  11. #11
    Fanatic Member stlaural's Avatar
    Join Date
    Sep 2007
    Location
    Quebec, Canada
    Posts
    683

    Re: Parsing/Copying Strings

    Edit : Took me too long to write my answer, you already solved your problem !

    As techgnome said :
    Quote Originally Posted by techgnome View Post
    LINQ is part of the 3.5FW... so it won't work against the 3.0FW.

    -tg
    Are you sure you are using Framework 3.5 ?
    1- to check select Project menu
    2- at the bottom should be "Your Project Name" Properties..., Select it
    3- in the Compile tab click on the button "Advanced Compile Options..."
    4- At the bottom of the newly opened window there is a dropdown titled "Target framework"
    Make sure .NET framework 2.5 is selected.

    Then you should have access to the library System.LINQ
    Alex
    .NET developer
    "No. Not even in the face of Armageddon. Never compromise." (Walter Kovacs/Rorschach)

    Things to consider before posting.
    Don't forget to rate the posts if they helped and mark thread as resolved when they are.


    .Net Regex Syntax (Scripting) | .Net Regex Language Element | .Net Regex Class | DateTime format | Framework 4.0: what's new
    My fresh new blog : writingthecode, even if I don't post much.

    System: Intel i7 920, Kingston SSDNow V100 64gig, HDD WD Caviar Black 1TB, External WD "My Book" 500GB, XFX Radeon 4890 XT 1GB, 12 GBs Tri-Channel RAM, 1x27" and 1x23" LCDs, Windows 10 x64, ]VS2015, Framework 3.5 and 4.0

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width