Search code examples
c#flow-control

Loading data into a FlowControl as you scroll - C#


I'm creating a program which displays product information and I want it to have two display modes, table view and then a scrollable control view with images etc.

I have all my product info loaded into a data table and want to use this to populate my FlowControl however, there is too much data and it times out.

Is there a method which can be used to load the data as the Flow is scrolled?

for(int i = 0; i < dt_prods.Rows.Count; i++)
{
    Product flowProd = new Product();
    flowProd.Controls["lbl_product"].Text = dt_prods.Rows[i]["product"].ToString();
    flow_products.Controls.Add(flowProd);
}

Above is my code that passes the data to the FlowControl currently.


Solution

  • Create some pagination instead for example your load 25 objects on the start of the application to the panel and then you create buttons dynamically that shows different data on your panel when you click on different buttons I think you can make it it's very easy