Results 1 to 5 of 5

Thread: How to open HTML file in VB.net program?

  1. #1
    Join Date
    Feb 2009
    Posts
    7

    How to open HTML file in VB.net program?

    Hi!

    How to open HTML file in VB?

    Thanks!

  2. #2
    Join Date
    May 2008
    Posts
    40

    Re: How to open HTML file in VB.net program?

    to open a html file from the hard disc you can use this method

    put a textbox +commandbutton and use this code:
    see that you enter the path of the htm file without any spaces.

    Option Explicit
    Private Sub Command1_Click()
    Shell "C:\Program Files\Internet Explorer\IEXPLORE.EXE" & Space(1) & Text1, vbNormalFocus
    End Sub
    'check the path of the iexplore.exe in your hard disc.

    or

    insert an ole control on form and insert the object from file say "C:\my documents\mypage.htm"
    this will appear as an icon. when you double click, the page opens.

  3. #3
    Join Date
    May 2008
    Posts
    63

    Re: How to open HTML file in VB.net program?

    HI

    You just add microsoft internet control in your component and your form.
    eg.
    webbrowser name to yahoomail, command button
    Private Sub Command1_Click()
    ' u can place html file also
    ' Yahoomail.Navigate (htmlfilenam)
    Yahoomail.Navigate ("http://mail.yahoo.com/?.intl=us")

  4. #4
    Join Date
    Feb 2008
    Posts
    1,852

    Re: How to open HTML file in VB.net program?

    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

  5. #5
    Join Date
    Apr 2008
    Posts
    2,005

    Re: How to open HTML file in VB.net program?

    Put a label on the form and use this ...

    Code:
       1.      Private Declare Function LoadCursor Lib "user32" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As Long) As Long
       2.      Private Declare Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long
       3.       
       4.      Private Const IDC_HAND = 32649&
       5.       
       6.      Private Sub label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
       7.          If X >= 0 And Y >= 0 And X < label1.Width And Y < label1.Height Then
       8.              SetCursor LoadCursor(0, IDC_HAND)
       9.          End If
      10.      End Sub

Similar Threads

  1. Learning Batch file to open a program or a file
    By Ikshana in forum Windows Software
    Replies: 3
    Last Post: 04-04-2011, 07:24 PM
  2. Replies: 4
    Last Post: 12-01-2011, 10:28 AM
  3. Replies: 3
    Last Post: 13-08-2010, 01:15 PM
  4. What program should I use to open a DLL file?
    By Enriquee in forum Operating Systems
    Replies: 3
    Last Post: 28-11-2009, 04:07 AM
  5. Wrong default program to open .dll file
    By Sitesh in forum Windows Software
    Replies: 3
    Last Post: 06-11-2009, 10:04 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,277,136.93215 seconds with 17 queries