I've been creating a Tabbed Browser application and am wondering about the garbage collection. I've zeroed out all of the variables, but I am wondering about the instances of the browser I am using when creating and deleting tabs.
I am using the following code to call up an instance of the WebBrowser (exBrowser) and placing it in a new Tab...
Dim tab As New TabPage
Dim brws As New exBrowser
wb = brws
brws.Dock = DockStyle.Fill
tab.Text = "tab"
tab.Controls.Add(brws)
brws.ScriptErrorsSuppressed = True
Me.TabControl1.TabPages.Add(tab)
Me.TabControl1.SelectedTab = tab
brws.Navigate2(strHomePage)
When I choose to Close or Delete a Tab, I am using:
TabControl1.TabPages.RemoveAt(TabControl1.SelectedIndex)
What happens to the WebBrowser instance (wb or brws) when I am deleting a Tab in this manner? Should I also be emptying this out as well in some way? I want to keep memory usage down and also believe this is still running despite deleting a Tab.
How should this object instance be handled insofar as it's creation and removal from memory? Thanks!
-Tom