PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
VS 2017 [RESOLVED] How To Access A New Declared Web Browser-VBForums
Results 1 to 3 of 3

Thread: [RESOLVED] How To Access A New Declared Web Browser

  1. #1

    Thread Starter
    Lively Member kshadow22's Avatar
    Join Date
    Dec 2014
    Location
    Kentucky
    Posts
    94

    Resolved [RESOLVED] How To Access A New Declared Web Browser

    vb.net Code:
    1. Dim page As New TabPage(String.Format("T " & (x_Count), TabControl1.TabPages.Count + 1))
    2.                     TabControl1.TabPages.Add(page)
    3.                     Dim browser As New WebBrowser()
    4.                     page.Controls.Add(browser)
    5.                     browser.Dock = DockStyle.Fill
    6.                     browser.Navigate(TextBox3.Text)

    This is the code I am using to create a new tab with a new web browser in it. However, how would I direct a "Web Browser Refresh" function or a "Navigate" button to these newly declared Web Browsers? What I have come up with is closing the tab and just reopening it with the specified URL, but that isn't hardly practical at all.

    Any tips? Thanks you guys!

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    102,938

    Re: How To Access A New Declared Web Browser

    If you're using standard controls then the obvious option is this:
    vb.net Code:
    1. TabControl1.SelectedTab.Controls.OfType(Of WebBrowser)().Single().Navigate(theNewUrl)
    This assumes that you want to affect the currently selected TabPage and it will always have one and only one WebBrowser control on it.

    That said, you may find it more useful to create your own custom controls and build the functionality you need into them, rather than just using the standard controls and fussing every time. Follow the CodeBank link in my signature below and check out my Tabbed Web Browser thread for an example of that.

  3. #3

    Thread Starter
    Lively Member kshadow22's Avatar
    Join Date
    Dec 2014
    Location
    Kentucky
    Posts
    94

    Re: How To Access A New Declared Web Browser

    Quote Originally Posted by jmcilhinney View Post
    If you're using standard controls then the obvious option is this:
    vb.net Code:
    1. TabControl1.SelectedTab.Controls.OfType(Of WebBrowser)().Single().Navigate(theNewUrl)
    This assumes that you want to affect the currently selected TabPage and it will always have one and only one WebBrowser control on it.

    That said, you may find it more useful to create your own custom controls and build the functionality you need into them, rather than just using the standard controls and fussing every time. Follow the CodeBank link in my signature below and check out my Tabbed Web Browser thread for an example of that.
    Iíll look into that. Ultimately, thatís what Iíll want is to figure out how to my make my own custom controls. Thank you!

Tags for this Thread

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