Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



How to open HTML file in VB.net program?

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 19-02-2009
Member
 
Join Date: Feb 2009
Posts: 7
How to open HTML file in VB.net program?
  

Hi!

How to open HTML file in VB?

Thanks!

Reply With Quote
  #2  
Old 19-02-2009
Member
 
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.
Reply With Quote
  #3  
Old 19-02-2009
Member
 
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")
Reply With Quote
  #4  
Old 19-02-2009
Member
 
Join Date: Feb 2008
Posts: 1,848
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
Reply With Quote
  #5  
Old 19-02-2009
Member
 
Join Date: Apr 2008
Posts: 2,001
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
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to open HTML file in VB.net program?"
Thread Thread Starter Forum Replies Last Post
Learning Batch file to open a program or a file Ikshana Windows Software 3 04-04-2011 07:24 PM
Getting error ?choose the program you want to open this file? after booting and startup Windows 7 Disha N Operating Systems 4 12-01-2011 10:28 AM
The action can't be completed because the folder or a file in it is open in another program error in windows 7 Its_Shaili Operating Systems 3 13-08-2010 01:15 PM
What program should I use to open a DLL file? Enriquee Operating Systems 3 28-11-2009 04:07 AM
Wrong default program to open .dll file Sitesh Windows Software 3 06-11-2009 10:04 PM


All times are GMT +5.5. The time now is 05:54 AM.