MSHTML - VB .Net 2003 - web pages not working

G

Guest

I am trying to use the Web Browser in a VB .Net windows application to host
external web sites. I have a problem when I try and capture one of the
document objects events.
I used the KB 311284 "How to handle...VB .Net". coied all the code into my
version of VS 2003.
The code contains "AddHandler..." code, when active
doesn't allow the textbox to recieve input, and the text links don't
navigate to the next URL.

When I comment out all the "AddHandler..." lines the browser acts as
expected but I don't have any way to trap for the document's events.

I've looked and looked on the Internet and MSDN and can't seem to find any
resolution.

What am I doing wrong here?

Thanks,
DK - Minneapolis
 
C

Cor Ligthert

DK,

This is again such a nice directly from C# translated sample, what has less
to do with VBNet.

Try this one (I added some things so watch typos it is not tested)

Open a new windows application project

In the toolbox rightclick and select add/Remove items

In the customize toolbox select Com and in that Microsoft Webbrowser

When that is in the toolbox drag it to your form (don't make it so small)

Drag also a button to your form.

Then add this code and you have a mini Webbrowser that catches the mshtml
documents in the arraylist

Private Documents as new Arraylist
'Because the documents can be frames
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Me.AxWebBrowser1.Navigate2("www.google.com")
End Sub
Private Sub AxWebBrowser1_DocumentComplete(ByVal sender As System.Object, _
ByVal e As AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent) _
Handles AxWebBrowser1.DocumentComplete
Dim wb As SHDocVw.WebBrowser = _
DirectCast e.pDisp, SHDocVw.WebBrowser)
Documents.Add(wb.Document)
End Sub

I hope this helps a little bit?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top