Bonjour,
j'ai un projet qui contient deux winform :
form1 : lance 3 thread qui a leurs tour lance une nouvelle instance du form2
form2 : contient un bouton + un composant WebBrowser (ie pour .net)

quand je supprime le composant webbrowser tous marche nickel, par contre si je le laisse j'obtiens un message de ce type :


"Impossible d'instance le contrôle ActiveX '8856f961-340a-11d0-a96b-00c04fd705a2', car le thread actuel n'est pas un thread cloisonné (STA, Single-Threaded Apartment)."


Code Form1:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 
   public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
 
         private void button1_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < 2; i++)
            {
                Thread th = new Thread(execute_th);
               th.Start();
            }
        }
         private void execute_th()
         {
             Application.EnableVisualStyles();
             Application.SetCompatibleTextRenderingDefault(false);
             Application.Run(new Form2());
         }
    }
Code Form2:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 
        public Form2()
        {
            InitializeComponent();
        }
 
        private void Form2_Load(object sender, EventArgs e)
        {
        }
 
        private void button1_Click(object sender, EventArgs e)
        {
        }
 
        private void ie_Navigating(object sender, WebBrowserNavigatingEventArgs e)
        {
 
        }
est ce que quelqu'un à un tuyaux ?

merci