0

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)
        
        FileClose(FileNo)

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...

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by Pgmer
0

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

0
If System.IO.File.Exists("Your file path") = True Then
        ' File exist do what you want
Else
         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.