Options

VB.Net Programming Question

Megadeth4168Megadeth4168 Member Posts: 2,157
I'm sorry if this does not belong in Off Topic, please feel free to move it.

Anyway, here is my question.

I'm making a Web Browser for work to be used as Public Kiosk. Basically, this will have buttons to go to 2 websites on the internet. Easy enough to do....

The problem I'm having is with New Windows... For instance, you right click a link and say open in new window.

Well, I'm able to capture this by forcing it to open a new instance of my form, but I want to be able to just open these links within the same form/axwebbrowser.

Any ideas?

Comments

  • Options
    JDMurrayJDMurray Admin Posts: 13,045 Admin
    When you display an HTML page in the WebBrowser control and click on a link in the page, the WebBrowser control should display the page of the link by default. It's not working this way for you?
  • Options
    Megadeth4168Megadeth4168 Member Posts: 2,157
    When I click a link, it does open in the AxWebBrowser Control. What I'm talking about are links that are set up to open a new browser window (Equivalent to right click, Open in New Window) . Without putting in a sub for NewWindow2 these links were opening in Internet Explorer instead of my Browser. So, I put in a sub using NewWindow2 to capture these links...

    What I have happening is that these pages are opening in a new window in my browser. That is fine for the moment, but I think it would be more beneficial to not open a new browser window, instead I would like to capture these new window commands and open the links in my Current control.

    Sorry, I'm kind of a newbie with programming, So it takes me a while to figure out how to do things that are probably very simple.
  • Options
    JDMurrayJDMurray Admin Posts: 13,045 Admin
    Capture the event using a delegate and write your own event handler. It looks like you will be using the WebBrowser control to lean about delegates and events. ;)
  • Options
    Megadeth4168Megadeth4168 Member Posts: 2,157
    JDMurray wrote:
    Capture the event using a delegate and write your own event handler. It looks like you will be using the WebBrowser control to lean about delegates and events. ;)

    Cool, do have any recommendations on some good online tutorials?
  • Options
    JDMurrayJDMurray Admin Posts: 13,045 Admin
    The standard place is msdn.microsoft.com, but you might hit Google first to find some .NET tutorials that are easier on the eyes and brain.

    For finding code samples, try codesearch.google.com and www.krugle.com.
  • Options
    Megadeth4168Megadeth4168 Member Posts: 2,157
    While browsing through the MSDN site I came across a post about using NewWindow3 instead of Newwindow2
       Private Sub axWebBrowser1_NewWindow3(ByVal sender As Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_NewWindow3Event) Handles AxWebBrowser1.NewWindow3
            Me.AxWebBrowser1.Navigate(e.bstrUrl)
            e.cancel = True
        End Sub
    

    This allowed me to use the e.bstrUrl that was not available to me before.
    Even though this has produced the required result, I still intend to go more in depth with programming. I think I will talk my boss into letting me pick up some good books.
Sign In or Register to comment.