title: How to add 1 progress bar on statusstrip to indicate the loading of each webbrowser on each tab?
body: <p>I am currently developing a custom made web browser using c# with different predefined capabilities. One of the problem that I encountered is adding a progress bar on the status strip. The first technique that i used to achieve this is by getting the <strong>webBrowser.Doument.Title</strong> and throwing it to the <strong>status strip label</strong> when the <strong>webBrowser_Navigated</strong> event has been triggered. Now this is acceptable because it is working properly, but when I decided to make my webBrowser capable of adding new tabs, my job got a lot more harder. I used the <strong>Extended Web Browser</strong> for me to achieve this which I also found here at SO. Here are the problems that is constantly giving me the headaches. I am a newbie in c# so for me I think this problems are extremely hard. =)</p>
  
  <pre><code>private void web_Navigated(object sender, WebBrowserNavigatedEventArgs e)
      {
          ExtendedWebBrowser web_navigated = new ExtendedWebBrowser();
          statusLoading.Text = "Loading " + ((ExtendedWebBrowser)TabControl1.SelectedTab.Controls[0]);
      }
  </code></pre>
  
  <ol>
  <li><p>The Loading label's text only shows the selected tab, when you click the other tabs it will still show the loading status of that specific page that you previously navigated not the status of the tab you are currently at. I think this is non-arguable because i am using this line on the navigated event. I can't find any other way of calling the tabBrowser other than selectedTab.Controls[0]. I am not sure if the work around here is programatically adding a status bar on each tab which I don't know how to do or even know if its possible.</p></li>
  <li><p>Now that I have mentioned tabbing on my browser, if I may ask is it possible to add a loading gif on the side of the Tab Title indicating that the browser on that tab is still loading? If anyone can teach me how to do it that is a tremendous help for me. =) </p></li>
  <li><p>As I have said I am using Labels to indicate my browser is loading, as the title implies i wish and i pray i can make it a progress bar. The problem with label is that when the browser's page is taking too long to load the user would presume that my system is not doing anything.</p></li>
  </ol>
  
  <p>So that covers it all, I appreciate everyone that helped me with my previous question, this question is a little bit tricky i hope i made this one very clear. Here are the codes that I am using to instantiate a ExtendedWebBrowser I made a function "OpenNewTab()" so that when i call it will automatically generate a new tab and a browser.</p>
  
  <pre><code>private void OpenNewTab(string url, string title="New Tab")
      {
          web = new ExtendedWebBrowser();
          web.ScriptErrorsSuppressed = true;
          web.Dock = DockStyle.Fill;
          web.Visible = true;
          web.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(web_DocumentCompleted);
          web.Navigated += new WebBrowserNavigatedEventHandler(web_Navigated);
          web.Navigating += new WebBrowserNavigatingEventHandler(web_Navigating);
          InitializeBrowserEvents(web);
          TabControl1.TabPages.Add(title + "  x");
          TabControl1.SelectTab(page_counter);
          TabControl1.SelectedTab.Controls.Add(web);
          page_counter++;
          ((WebBrowser)TabControl1.SelectedTab.Controls[0]).Navigate(url);
      }
  //I am not sure if i should include other browser events here, as you can see the other three are up there. =)
      private void InitializeBrowserEvents(ExtendedWebBrowser SourceBrowser)
      {
          SourceBrowser.NewWindow2 += new EventHandler&lt;NewWindow2EventArgs&gt;(SourceBrowser_NewWindow2);
      }
      //This event right here is the one responsible for catching the open in a new window and throwing it to a 
      //new tab, because the open in a new tab is always disabled at web browser i presumed this is the only option they  
      //have, whoever made the ExtendedWebBrowser I thank you for this code he gains all the credit. =)   
      private void SourceBrowser_NewWindow2(object sender, NewWindow2EventArgs e)
      {
          TabPage NewTabPage = new TabPage()
          {
              Text = "New Tab x"
          };
          web = new ExtendedWebBrowser()
          {
              Parent = NewTabPage,
              Dock = DockStyle.Fill,
              Tag = NewTabPage
          };
          web.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(web_DocumentCompleted);
          web.Navigated += new WebBrowserNavigatedEventHandler(web_Navigated);
          e.PPDisp = web.Application;
          InitializeBrowserEvents(web);
          TabControl1.TabPages.Add(NewTabPage);
          TabControl1.SelectedTab = NewTabPage;
          page_counter++;
      }
  </code></pre>