Results 1 to 4 of 4

Thread: html file opening

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2000
    Posts
    16

    Question

    I was wondering how to open a html file so you can view and edit the code in a text box?
    Anyone know would be helpful

  2. #2
    Guest
    Either use MSInet:

    Code:
    Text1.text = Inet1.OpenURL("http://www.site.com")
    Or use the ShDocVw.Dll (Webbrowser) Control:

    Code:
    Text1.Text = Webbrowser1.Document.documentElement.innerHTML

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jun 2000
    Posts
    16

    from hd

    sorry i ment to open from a hard drive or disk

  4. #4
    Guest
    Well, using MSInet, you have to be connected. But Webbrowser way, you do not have to be connected.

    Code:
    'Put this code in the form declarations:
    Dim modified As Integer
    'Modifed 0 = not changed
    'Modifed 1 = changed
    
    Private Sub Form_Load()
    modified = 0
    Webbrowser1.Navigate "C:\htmlfile.htm"
    Text1.Text = Webbrowser1.Document.documentElement.innerHTML
    End Sub
    
    Private Sub Text1_Change()
    modified = "1"
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
    If modified = 1 Then
    'file has been edited!
    Open "C:\htmlfile.htm" For Output As #1
    Print #1, Text1
    Close #1
    Unload Me
    Set form1 = Nothing
    End
    Else
    'no change has been made
    Unload Me
    Set form1 = Nothing
    End
    End If
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width