PDA

Click to See Complete Forum and Search --> : WebBrowser Problem


Dubious
Jan 19th, 2000, 03:31 AM
I have created a webbrowser using VB the WebBrowser object. When a new window is generated from a web page(thru a link). The default browser(IE) opens up the new page. I would like my browser to create a new instance of itself for the new window. Do I have to set my browser as the default? Is there any way around this? Please help with this dilemna.

Thanks

Dubi

CarlosTheJackal
Jan 19th, 2000, 10:33 AM
Hey-This is kinda hard to explain so if you still dont get it toss me an email at durnkenzealot@hotmail.com. ok, assuming frmBrowser is the form and wbwebbrowser1 is browser:

Private Sub wbwebbrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
'declare a new instance of the form
dim frmbrowser2 as frmbrowser
Set ppDisp = frmBrowser2.wbwebbrowser1.Object
frmbrowser2.show

...im sure there are other ways to do this, the important part is the newwindow2 event is triggered and the ppDisp is the webbrowser to referece...and dont forget to put
Set frmBrowser2 = Nothing in an unload event,
probably in the frmbrowser2_form_unload event
Hope this helps,and like i said if u need more help email me.

Thnx for your time,
CarlosTheJackal

CarlosTheJackal
Jan 20th, 2000, 04:29 AM
Hey- Im Sooooo sorry i forgot one line of code: after the dim frmbrowser2 as frmbrowser
put in
Set frmBrowser2 = new frmBrowser
then take out the createobject stuff, and dont forget to make the "Set ppDisp" line like i had it origionally (referencing the webbrowser object as well as the form)
that sould do it, im at school right now so i cant test it...if it still doesnt work reply again and when im home ill get the right code...really sorry, i have the multiple forms code in my form load event so i missed it =P

Sorry For any sloppiness, im between classes so kinda in a hurry

Thnx For Your Time,
CarlosTheJackal

Dubious
Jan 20th, 2000, 11:41 AM
CarlosTheJackal,

Thanks for posting a response to my problem. I understand what you have posted as far as creating a new instance of the form. I still have one small problem. The code you supplied generates an error stating that the 'variable or with block not set'. So....I was assuming I needed to 'CreateObject' but I am still having problems. I also tried to 'force' the new window into the original by assigning the cancel parameter to true, but that didnt work either.


Public Sub frmBrowser_NewWindow2(ppDisp As Object, cancel As Boolean)
'declare a new instance of the form
Dim frmbrowser2 As Form1
Set frmbrowser2 = CreateObject(Form1) Wrong parameter?

Set ppDisp = frmbrowser2.Object
frmbrowser2.Show
End Sub



I appreciate all of the help. Thank you very much.



Dubi

Dubious
Jan 26th, 2000, 05:12 AM
thanks for all the help CarlosTheJackal. Works great.