Results 1 to 3 of 3

Thread: [RESOLVED] how to use *.txt in vb

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2006
    Posts
    507

    Resolved [RESOLVED] how to use *.txt in vb

    I am trying to read information from any TXT file in a folder. How can I use *.txt?

    Thanks

  2. #2
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: how to use *.txt in vb

    The Directory.GetFiles method lets you specify a search pattern:
    Code:
            For Each f As String In Directory.GetFiles("C:\Temp", "*.txt")
                ' do something with f
                MessageBox.Show(f)
            Next

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2006
    Posts
    507

    Re: how to use *.txt in vb

    Thanks, I did it this way and it worked too

    For Each foundfiles As String In My.Computer.FileSystem.GetFiles(Logfilefolder, FileIO.SearchOption.SearchTopLevelOnly

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