Want to open the Visual Basic by Notepad. But can’t..

Asked By 20 points N/A Posted on -
qa-featured

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.

SHARE
Answered By 0 points N/A #149953

Want to open the Visual Basic by Notepad. But can’t..

qa-featured

Hi,

There are few issues in visual basics when working with text files. 

These are:-

  1. Security Exceptions.
  2. File encodings.
  3. Incorrect path.

What kind of error are you getting? If you are getting this message.

File Not Found Exception was unhandled

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

Related Questions