title: invoking a webbrowser to the second tab page visual c#
body: <p>hey i am trying to create two webbrowsers on a sperate thread from the rest of the form. one goes to tabpage1 and the other is added to tabpage2. the first browser creates fine to page1 however the second browser wont add and the error "Unable to get the window handle for the 'WebBrowser' control. Windowless ActiveX controls are not supported." happens. heres my code:</p>
  
  <pre><code>private Thread t;  
  WebBrowser webBrowser1, webBrowser2;  
  public delegate void Addc1(Control o);  
  public delegate void Addc2(Control o);  
  public Addc1 AddControl1;  
  public Addc2 AddControl2;  
  public Form1()  
  {  
          InitializeComponent();  
          AddControl1 = new Addc1(AddTabControl1);  
          AddControl2 = new Addc2(AddTabControl2);         
  }        
  private void button2_Click(object sender, EventArgs e)  
  {  
          t = new Thread(new ThreadStart(this.UIStart));  
          t.SetApartmentState(ApartmentState.STA);  
          t.Start();  
  }  
  public void UIStart()  
  {  
              WebBrowser webBrowser1 = new WebBrowser();  
              webBrowser1.Location = new System.Drawing.Point(1,1);  
              webBrowser1.Size = new System.Drawing.Size(936, 35);  
              webBrowser1.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.webBrowser2_DocumentCompleted);  
              tabPage1.Invoke(AddControl1, new Object[] { webBrowser1 });  
  
              WebBrowser webBrowser2 = new WebBrowser();  
              webBrowser2.Location = new System.Drawing.Point(1,1);  
              webBrowser2.Size = new System.Drawing.Size(936, 935);  
              webBrowser2.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.webBrowser2_DocumentCompleted);    
              tabPage2.Invoke(AddControl2, new Object[] { wedBrowser2 });  
  
  
              webBrowser1.Navigate("www.ask.com");  
              webBrowser2.Navigate("www.google.com");  
          }  
          public void AddTabControl1(Control o)  
          {  
              tabPage1.Controls.Add(o);  
          }  
          public void AddTabControl2(Control o)  
          {  
              tabPage2.Controls.Add(o);  
          }  
  }  
  </code></pre>
  
  <p>as i said the webbrowser1 will create and navigate but the other one will add to the controls on page2 but will not create. any ideas?
  thanks adds</p>