Discussion Locked

Open HTML File in VB .net

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Can anyone tell me; How to open an html file in vb .net application AND How we can get app path in vb .net (like vb 6.0).

Thanks
HEMAL SHAH

3 replies

by dsr28

First, to open an any file, even HTML:
Imports System
Imports System.IO

Class Test
Public Shared Sub Main()
Try
' Create an instance of StreamReader to read from a file.
Dim sr As StreamReader = New StreamReader("TestFile.html")
Dim line As String
' Read and display the lines from the file until the end
' of the file is reached.
Do
line = sr.ReadLine()
Console.WriteLine(Line)
Loop Until line Is Nothing
sr.Close()
Catch E As Exception
' Let the user know what went wrong.
Console.WriteLine("The file could not be read:")
Console.WriteLine(E.Message)
End Try
End Sub
End Class

Next, to find the app path:
use Application.ExecutablePath

This discussion is closed to new replies.