Hey Guys,

I am attempting to open a CSVfile with a StreamReader that I have downloaded using WebClient.DownloadFile() but am receiving error:

The process cannot access the file 'x.csv' because it is being used by another process.
Code:
        Dim wb As New System.Net.WebClient()
       
        wb.DownloadFile(sSource, sDataFilePath)

        wb.Dispose()
        wb = Nothing
        
        Dim textReader As System.IO.StreamReader = Nothing

        textReader = New System.IO.StreamReader(sDataFilePath)
The last line throws the exception. I think somehow the webclient is holding a lock on the file but how? I am disposing of the webclient and being extra cautious by setting it to Nothing.

How else can I be sure the webclient has let go? Or better yet does anyone know exactly what is going on?

Thanks ppl!
Matt.