Hello everyone. I feel quite silly posting this as I know my way around C++ decently and am writing an application in VB however I am getting quite frustrated with this problem.

Dim FileNo As Integer
        FileNo = FreeFile()
        Dim FILE_NAME As String = "C:\test.txt"
        FileOpen(FileNo, FILE_NAME, OpenMode.Input)

When executing the above code it says at the FileOpen operation that the document does not exist or the relative path may not be right... I have looked in many place over the internet and even used the same examples from the Microsoft website however I get the same error. Can someone please point out what could be wrong with the above?

Thanks in advance...

7 Years
Discussion Span
Last Post by Pgmer

FileOpen is not available in vb6 but in vb.net
I will ask moderator to move this thread to vb.net section.
You will get more answer there from many gurus.

Edited by Jx_Man: n/a

If System.IO.File.Exists("Your file path") = True Then
        ' File exist do what you want
         Messagebox.show("File does not exists")
        End If

The above code is vb.net syntax to check the file exist or not in specific location. may be simillar function may exist in vb6 also.

Edited by Pgmer: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.