** Making a Web Browser in VB6 **

  ThisNameIsMine 13:23 27 May 03
Locked

Hi, I am making a web browser in VB6 LE. When I try and drag the msinet control on it says I dont have the appropriate license. I have run the patch from the MS website but it still wont load on my form. Is there any way of getting the HTML from the current page in WebBrowser1 and displaying it, in a Rich Text Box for instance?

  Elrond 16:55 27 May 03

Can you give some more info as I'm not sure where your coming from here. This is my assumption, you've started a new exe and then added the web browser control to your control tab and then tried to get that onto your form but it wont let you. Is this right?

  Elrond 17:21 27 May 03

Having another think, is it that you've got the control onto the form and then have tried to run the program and got a page cannot be displayed error on the browser? If this is the case then it wont work until you make the final executable. However, I'm not sure the Learning Edition allows you to do this.

  Elrond 17:32 27 May 03

If you want to display the HTML of a page in a normal text box, try this. Set up a browser and a normal text box on your form. Add a combo box, and a command button. Also add a file menu in the menu editor with a close button in that menu. Dont worry about placement the following code will do it for you. Copy and paste it into your code window.


Private Sub Command1_Click() 'this is the "Go" button
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
Form1.Caption = " " & Combo1.Text
End Sub


Private Sub Command2_Click()
WebBrowser1.Stop
End Sub


Private Sub Command3_Click()
WebBrowser1.Refresh
End Sub

Private Sub Command4_Click()
WebBrowser1.GoBack
End Sub

Private Sub Command5_Click()
WebBrowser1.GoForward
End Sub

Private Sub Form_Load()
Form1.Caption = " " & Combo1.Text
Combo1.AddItem "click here"
Combo1.Text = "click here"
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 - 300
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 mnuFileClose_Click()
Unload Me
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

  Elrond 17:34 27 May 03

Where there are click here's just add a wesite url. Such as your homepage

  ThisNameIsMine 21:39 27 May 03

THANKYOU!!!!!!!!!!!!!!!!!!!!!!

  Elrond 09:57 28 May 03

Is that what you needed then?

This thread is now locked and can not be replied to.

Best phone camera 2016/2017: Galaxy S7 vs iPhone 7 vs Google Pixel vs HTC 10 Evo vs OnePlus 3T vs…

1995-2015: How technology has changed the world in 20 years

The Pantone Colour of the Year 2017 is Green

Super Mario Run preview | Hands-on first impressions of Super Mario Run: Mario's iPhone & iPad…