Click here to Skip to main content
14,984,032 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have a tabbed web browser so every time i close a tab the tab is closed but the process is still running for example one of my tabs there is a YouTube page opened so if i close that tab the video is still running you even can hear the sounds so how to close and kill the web browser process in the selected tab.
and here is the code
VB
Public Sub removetab()
    If TabControl1.TabPages.Count <> 1 Then
        Dim browser As webbrowser = Me.TabControl1.SelectedTab.Tag
        browser.Stop()
        TabControl1.TabPages.Remove(TabControl1.SelectedTab)
        url.Text = TabControl1.SelectedTab.Text
    End If
End Sub
Posted
Updated 12-May-15 21:38pm
v2
Comments
   
Who told you that a separate process is associated with each tab?
Another question is on he WebBrowser type. Which one? Full type name, please. Do you think there is only one? Wrong.
—SA
Member 11667739 13-May-15 7:21am
   
i want when the current tab is closed the webbrowser in that tab must closed
   
Full type name, please.
—SA

1 solution

Please see my comment to the question.

Call webbrowser.Dispose(). Never forget to call System.IDisposable.Dispose() for each and every instance of every type implementing this interface.

You should not ask such ambiguous questions about controls you failed to name precisely. Both type simple names TabControl and WebBrowser are ambiguous. Do I even need to tell you where they can appear? Either mention full type names, or show your using/imports directives, or specify UI library you are using.

—SA
   
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900