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

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.

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.

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.