Hi everyone.
I'm trying to use a Thread in a simple winform. I have a ListBox which I want to fill with numbers at the form's load method. I don't want to wait until it is filled. I'm using something like this:
void fillList()
{
Invoke(new MethodInvoker(
delegate
{
while(true)
{
i++;
listBox1.Items.Add(i);
if(i == 4000)
break;
}
}));
}
Then at the Load method I'm doing this:
Thread tr = new Thread(fillList());
tr.Start();
Why it isn't working?
I get this error: Method name expected (CS0149)
Thanks.