Hello all,
I am trying to open a text file of Visual Basic. But it doesn't open. I am finding error there. Have you any easy solution that it can easily open just by a click. Please help me with solving.
Thank you.
Want to open the Visual Basic by Notepad. But can’t..
Hi,
There are few issues in visual basics when working with text files.Â
These are:-
-
Security Exceptions.
-
File encodings.
-
Incorrect path.
What kind of error are you getting? If you are getting this message.
Then the file you are trying to open doesn’t exist. To check it use the following code:-
Dim FILE_NAME As String = "C:UsersOwnerDocumentstest.txt"
If System.IO.File.Exists(FILE_NAME) = True Then
Dim objReader As New System.IO.StreamReader(FILE_NAME)
TextBox1.Text =Â objReader.ReadToEnd
objReader.Close()
Else
MsgBox("File Does Not Exist")
End If>
If there is some other error and you are using visual basic 2005 you can try to fix it using Microsoft Support website.
Regards,
Laz Zebbena