I was trying to add some controls using a loop in to flowlayoutpanel from other thread than the main thread but I can't do it. Any Help ? This code is running on UI thread
private bool ShowProducts(string Page ,string KeyWord)
{
string Res = AO.GetPageInfo(Page ,textBox1.Text);
if(Res == ""){
return false;
}
label12.Text = Res;
CurrentPage = int.Parse(Page);
textBox3.Text = Page;
//flowLayoutPanel2.Visible = false;
flowLayoutPanel2.Controls.Clear();
Products = AO.SearchProducts(CurrentPage.ToString(), textBox1.Text);
foreach(Product X in Products)
flowLayoutPanel2.Controls.Add( new Card(X) );
return true;
}