Results 1 to 5 of 5

Thread: WebBrowser Problem

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2000
    Location
    Phx, AZ USA
    Posts
    23

    Post

    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

  2. #2
    Member
    Join Date
    Feb 1999
    Location
    ,Mo,USA
    Posts
    36

    Post

    Hey-This is kinda hard to explain so if you still dont get it toss me an email at [email protected]. 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

  3. #3
    Member
    Join Date
    Feb 1999
    Location
    ,Mo,USA
    Posts
    36

    Post

    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

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Jan 2000
    Location
    Phx, AZ USA
    Posts
    23

    Post

    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

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jan 2000
    Location
    Phx, AZ USA
    Posts
    23

    Post

    thanks for all the help CarlosTheJackal. Works great.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width