|
-
Aug 10th, 2000, 05:37 PM
#1
Thread Starter
Junior Member
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
-
Aug 10th, 2000, 05:41 PM
#2
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
-
Aug 10th, 2000, 05:44 PM
#3
Thread Starter
Junior Member
from hd
sorry i ment to open from a hard drive or disk
-
Aug 10th, 2000, 05:55 PM
#4
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|