Using system. Threading;
Namespace windowsformsapplication2
{
Public partial class form1: Form
{
Private delegate void flushclient ();
Public form1 ()
{
Initializecomponent ();
}
Private void form1_load (Object sender, eventargs E)
{
Thread th = new thread (New threadstart (bindthread ));
Th. isbackground = true;
Th. Start ();
}
private void bindthread ()
{< br> for (INT I = 0; I <4; I ++)
{< br> thread chreceivth = new thread (New threadstart (start);
chreceivth. start ();
}< BR >}
Public void start ()
{
While (true)
{
Threadfunction ();
Thread. Sleep (4000 );
}
}
Private void threadfunction ()
{
If (this. datagridview1.invokerequired)
{
Flushclient fc = new flushclient (threadfunction );
This. Invoke (FC );
}
Else
{
List <person> Per = new list <person> ();
Per. Add (new person ("Wu junyang", 28 ));
Per. Add (new person ("Wu Xiaoyang", 20 ));
This. Maid = per;
}
}
}
}
Http://www.cnblogs.com/Linford-Xu/archive/2012/09/19/2693340.html