VB6: Webbrowser - open link in same window-VBForums
Results 1 to 6 of 6

Thread: VB6: Webbrowser - open link in same window

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2010
    Posts
    4

    VB6: Webbrowser - open link in same window

    Hello,
    I am using VB6. How do I capture to open link in SAME WEBBROWSER? I dont want to open new window/webbrowser.
    thx
    Karol77

  2. #2
    Member
    Join Date
    Mar 2010
    Location
    Zandvoort - Netherlands
    Posts
    45

    Re: VB6: Webbrowser - open link in same window

    webbrowser1.navigate "http://google.com"

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    20,001

    Re: VB6: Webbrowser - open link in same window

    navigate to the href of the link
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  4. #4

    Thread Starter
    New Member
    Join Date
    Mar 2010
    Posts
    4

    Re: VB6: Webbrowser - open link in same window

    Hello,
    I have found resolution, but for VB_NET. I use VB6, can you translate to VB6?
    thx
    Karol77
    http://www.vbforums.com/showthread.p...ebbrowser+form

  5. #5
    PowerPoster
    Join Date
    Dec 2004
    Posts
    20,001

    Re: VB6: Webbrowser - open link in same window

    that is easy enough to do in vb6, but it would still appear like a new browser window, rather than opening in the same window

    vb Code:
    1. Dim f As Form1
    2. Set f = New Form1
    3. f.Caption = "My New Form"
    4. f.Show
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  6. #6
    New Member
    Join Date
    Jul 2012
    Posts
    6

    Re: VB6: Webbrowser - open link in same window

    Under the WebBrowser control's "New Window" event, add this code:
    Dim myElement As HtmlElement = WB.Document.ActiveElement
    Dim target As String = myElement.GetAttribute("href")
    WB.Navigate(target)
    e.Cancel = True

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.