troubleshooting Question

vb.net - check record from a text file

Avatar of XK8ER
XK8ERFlag for United States of America asked on
Visual Basic.NET
10 Comments1 Solution282 ViewsLast Modified:
hello there,
I am trying to use this code to search for a record in a text file but its not really working on vb.net like it used to on vb6..
what can I do to make it work ?
Function FileExists(ByVal FileName As String) As Boolean
        FileExists = (Dir(FileName, vbSystem + vbHidden) <> "")
    End Function

    Function Search_inFile(ByVal sFind As String, ByVal strFileName As String) As Boolean
        Dim sFile As String, i As Long
        i = FreeFile
        If FileExists(App.Path & "\Settings\" & strFileName) Then

        Open App.Path & "\Settings\" & strFileName For Binary As #i
            sFile = Space$(LOF(i))
        Get #i, , sFile

            If InStr(sFile, sFind) <> 0 Then
                Search_inFile = True
            End If
        Close #i
        End If
    End Function
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 10 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros