I am trying to used following code but I am not getting good performance in my Application.
I have list of 2000 images in “dt_Images.ToList()”.
In cs:
foreach (var dr in dt_Images.ToList())
{
BTN = new Button();
BTN.Name = dr.Name.ToString();
BTN.Image = dr.Image;
BTN.Text = dr.text.ToString();
flowLayoutPanel1.Controls.Add(BTN);
BTN.Click += new EventHandler(this.pic_Click);
}
I have also try to binding with listview but not getting desired speed.
How can I increase speed while binding with flowLayoutPanel?
can i bind direct DataSource in control? then which control i used?
Please help me
I can see that you are using a
FlowLayoutpanel. I suspect it to redo the whole layout each time you add a child control, which might take a lot of time too.Can you try to enclose the whole loop this way :
You can even try to achieve even better performances by disabling the painting using the answers here.