I've got a WebBrowser object embedded into the form, and when it opens a link in a new window, rather than the current window, it opens it inside Internet Explorer, rather than either in the current Window, or inside another form in the app itself.
How exactly do I make it launch in either
A) The current window
B) a new window of the current app
I've seen a few things, but those were for a different WebBrowser object, and don't work using the one provided by default in VB.NET Express edition.
[VB.NET]WebBrowser Object Help
Started by
Guest_CheeseBurgerMan_*
, Aug 23 2006 04:45 AM
22 replies to this topic
#1
Guest_CheeseBurgerMan_*
Posted 23 August 2006 - 04:45 AM
Guest_CheeseBurgerMan_*
|
|
|
#2
Posted 23 August 2006 - 05:25 AM
Well If it was VB 6.0 I would help you( I know how to do it :) )! but VB.NET, I never used it :S lol
#3
Guest_CheeseBurgerMan_*
Posted 23 August 2006 - 08:49 AM
Guest_CheeseBurgerMan_*
Tcm9669 said:
Well If it was VB 6.0 I would help you( I know how to do it :) )! but VB.NET, I never used it :S lol
How would you do it in VB 6.0? I may be able to at least get the idea from that code, and then convert it into working VB.NET code.
#4
Posted 23 August 2006 - 10:37 AM
Well its complicated either DO NOT ALLOW NEW WINDOWS by making
Or well to enable new windows umm you should let the IE popup and then capture the IE window and display it into your form! Well actually its like Stealing the window! Umm its a complicated code! VERY complicated! and atm I cant find the code! I dont know if you could do this in VB .NET!
regards
Tcm9669
Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean) Cancel = True End Sub
Or well to enable new windows umm you should let the IE popup and then capture the IE window and display it into your form! Well actually its like Stealing the window! Umm its a complicated code! VERY complicated! and atm I cant find the code! I dont know if you could do this in VB .NET!
regards
Tcm9669
#5
Guest_CheeseBurgerMan_*
Posted 23 August 2006 - 12:29 PM
Guest_CheeseBurgerMan_*
Alright, I've gotten the program so that I can make it run code when a new window is about to open, however I'm now stuck with exactly what code to run. :P
UPDATE: I've gotten it to supress the Internet Explorer window, and open a new window of my app, but I'm stuck on how to make it open the new window with the correct URL. :)
For anyone else's reference, this code should work:
UPDATE: I've gotten it to supress the Internet Explorer window, and open a new window of my app, but I'm stuck on how to make it open the new window with the correct URL. :)
For anyone else's reference, this code should work:
Private Sub WebBrowser1_NewWindow(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles WebBrowser1.NewWindow 'insert whatever code you want to run here End Sub
#6
Posted 23 August 2006 - 12:40 PM
Lol, thats like the code I sent you but Well if you want to open that in your windows umm you should get the URL and then open a new window with a WebBrowser and browse that URL! I am sure there is a way, But I dont know it yet! But there is always the complicated method to use!! ( but i cant find the source )
#7
Guest_CheeseBurgerMan_*
Posted 23 August 2006 - 12:52 PM
Guest_CheeseBurgerMan_*
Tcm9669 said:
Lol, thats like the code I sent you but Well if you want to open that in your windows umm you should get the URL and then open a new window with a WebBrowser and browse that URL! I am sure there is a way, But I dont know it yet! But there is always the complicated method to use!! ( but i cant find the source )
It's similar (which is to be expected since they're both a version of Visual Basic), but the code is different. The code you sent me didn't work (although it's not surprising since it's VB 6 code), while my modified version works perfectly in VB.NET. ;) But on to the programming.
I love that idea, but the actual execution of that is, at least for now, eluding me. I can do more searching, and see what I can find out.
#8
Posted 23 August 2006 - 01:06 PM
CheeseBurgerMan said:
It's similar (which is to be expected since they're both a version of Visual Basic), but the code is different. The code you sent me didn't work (although it's not surprising since it's VB 6 code), while my modified version works perfectly in VB.NET. ;) But on to the programming.
I love that idea, but the actual execution of that is, at least for now, eluding me. I can do more searching, and see what I can find out.
I love that idea, but the actual execution of that is, at least for now, eluding me. I can do more searching, and see what I can find out.
Hope you find :) Well I made a quick search for you, but no success, hope you find!
Lol I found a PREFECT one for VB6, perhaps you can translate the code yourself
Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean) Dim frm As Form1 Set frm = New Form1 Set ppDisp = frm.WebBrowser1.Object frm.Show End Sub
Lol this WORKS PERFECTLY!!!
Anyways Hope this VB helps you!
#9
Guest_CheeseBurgerMan_*
Posted 23 August 2006 - 01:48 PM
Guest_CheeseBurgerMan_*
Thanks, that does help a bit. I do have one question though.
How does this line know what the URL for the new window should be? I'm not sure how to translate this into VB.NET.
How does this line know what the URL for the new window should be? I'm not sure how to translate this into VB.NET.
Set ppDisp = frm.WebBrowser1.Object
#10
Posted 24 August 2006 - 12:47 AM
Well actually I don know, I told you that I found that on the NET, but as you can see ppDisp is a property of the webbrowser and I think that that determies the URL! dont know but I tried it and it works just fine! I think that instead of ppDisp you need to use the sender property in VB.NET!
Not so sure !
Not so sure !
#11
Guest_CheeseBurgerMan_*
Posted 24 August 2006 - 04:05 AM
Guest_CheeseBurgerMan_*
Tcm9669 said:
Well actually I don know, I told you that I found that on the NET, but as you can see ppDisp is a property of the webbrowser and I think that that determies the URL! dont know but I tried it and it works just fine! I think that instead of ppDisp you need to use the sender property in VB.NET!
Not so sure !
Not so sure !
Yeah, here's the code that I've gotten.
Private Sub WebBrowser1_NewWindow(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles WebBrowser1.NewWindow
Dim frm As MainWindow
frm = New MainWindow
' sender = frm.WebBrowser1
frm.Show()
e.Cancel = True There's no WebBrowser1.Object in VB.NET (at least, according to IntelliSense), so I'm a bit at a loss for what to put on that line. :)
#12
Posted 24 August 2006 - 04:16 AM
What else you got? like Webbrowser1.Bla bla bla
What you got perhaps I can help you!
What you got perhaps I can help you!


Sign In
Create Account

Back to top










