VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This is a web browser/html code viewer. Top half of screen displays web page while bottom half disp

by Hugh Musser (8 Submissions)
Category: Internet/HTML
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Sun 29th September 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

This is a web browser/html code viewer. Top half of screen displays web page while bottom half displays html code for displayed page.

API Declarations


Add a button named Command1, set caption property to GO.
Add a combobax named Combo1.
Add a webrowser control named WebBrowser1.
Add a textbox named Text1, set multiline=true, set scrollbars= 3-Both
Copy code below into code section of form.
Don't worry about contol positions, code will set those.

Rate This is a web browser/html code viewer. Top half of screen displays web page while bottom half disp



AddToCombo1 Combo1.Text 'if new url, add to combo1 box
WebBrowser1.Navigate Combo1.Text 'request web control to find url
Text1.Text = "Getting HTML code for " & Combo1.Text
End Sub

Private Sub Form_Load()
Combo1.AddItem "http://www.vbcode.com"
Combo1.Text = "http://www.vbcode.com"
WebBrowser1.Navigate Combo1.Text 'request web control to find url
Text1.Text = "Getting HTML code for " & Combo1.Text
Me.WindowState = vbMaximized
End Sub

Private Sub Form_Resize()
Dim ScrnHt As Long
Me.ScaleMode = 3
ScrnHt = (Me.ScaleHeight - 24) / 2
Command1.Top = 2
Command1.Left = 2
Command1.Width = 35
Command1.Height = 23
Combo1.Top = 2
Combo1.Left = 37
Combo1.Width = Me.ScaleWidth - 37
WebBrowser1.Top = 27
WebBrowser1.Left = 2
WebBrowser1.Height = ScrnHt
WebBrowser1.Width = Me.ScaleWidth - 4
Text1.Top = 23 + ScrnHt + 6
Text1.Left = 2
Text1.Height = ScrnHt - 6
Text1.Width = Me.ScaleWidth - 4
End Sub

Private Sub AddToCombo1(ByVal URL As String)
'if new utl, adds it to combobox for session history
Dim Lcnt As Long

Lcnt = Combo1.ListCount

For i = 0 To Lcnt
    If URL = Combo1.List(i) Then Exit Sub
Next i

Combo1.AddItem URL

End Sub

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
'when web control retrieves page, this event fires and displays html code
On Error Resume Next
Text1.Text = WebBrowser1.Document.documentElement.outerHTML
End Sub



Download this snippet    Add to My Saved Code

This is a web browser/html code viewer. Top half of screen displays web page while bottom half disp Comments

No comments have been posted about This is a web browser/html code viewer. Top half of screen displays web page while bottom half disp. Why not be the first to post a comment about This is a web browser/html code viewer. Top half of screen displays web page while bottom half disp.

Post your comment

Subject:
Message:
0/1000 characters