Add the following line to the top of the code file:
Imports System.IO
Also, as Daniel suggested, it might be helpful to make the code more understandable to indicate your types, for example:
Dim tmpFile As String = Path.GetTempFileName() Dim tmpFileStream As FileStream = File.OpenWrite(tmpFile)
In recent versions of VB, it automatically infers the type for you, so tmpFile will be a variable of type String , even if you did not specify. However, in older versions of VB, it will simply become the base type of Object , in which case it will not be able to determine which overload to use.
source share