Most controls dont allow to be accessed from a thread other than the UI thread. Therefore, these controls have an invoke method which can be called from a different thread.
Your AddData could be written like this so that it will also function from a different thread.
public void AddData()
{
if (this.InvokeRequired)
{
this.Invoke(new MethodInvoker(AddData));
}
else
{
for (int i = 0; i < 20; i++)
{
listBox1.Items.Add(i);
}
}
}
Hope this helps.