Hi group,

I'm attempting to use a variable (i) to read the multiple files within a folder. However this doesn't seem to be working. Can you tell me what I'm doing wrong?

For i = 0 To counter
Dim objReader As New System.IO.StreamReader(getRestranName(i))

    If System.IO.File.Exists(folderName) Then
         Do While objReader.Peek() <> -1
            txtLine = objReader.ReadLine()
            If lineNo = 3 Then
               programName = Trim(Microsoft.VisualBasic.Left(txtLine, 10))

In advance, thanks for your help.

Don

Please post full codes. seeing a part, it is impossible to say about your problems.

Shark1, the problem I'm having is that StreamReader isn't reading "getRestranName(i)". My assumption is that the "i" is the problem. But I'm not sure why.

Shark1, I found the issue. I changed (folderName) to (getRestranName(i)). That solved it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.