Bonjour,
J'ai fait un programme avec une fonction public void RefreshListes(). C'est mon Form1.cs :
Dans celui-ci je mets à jour des objets notamment labels et autres listbox.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 namespace Cerbero_V2 { public partial class Form1 : Form { public void RefreshListes() } }
Ensuite, dans Program.cs je fais un Multithread :
Seulement, dans mon Thread2(), je souhaite appeler ma fonction RefreshListes() qui se trouve dans Form1.cs, seulement, impossible ...
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 namespace Cerbero_V2 { public class Program { [STAThread] static void Main() { Thread tid1 = new Thread(new ThreadStart(MyThread.Thread1)); Thread tid2 = new Thread(new ThreadStart(MyThread.Thread2)); tid2.IsBackground = true; tid1.Start(); tid2.Start(); } } public class MyThread { public static void Thread1() public static void Thread2() }
Merci !
Partager