For loop through DataTable rows is very slow in Windows Application

Last Reply 4 months ago By dharmendr

Posted 4 months ago

I have table item and i have create for each item button in the container panel and create text box for search on item that if the button text contain the searched text set visible true else false and it work but it's really slow and look like there an issue in my application.

So there faster way to search on the item [button]

When select category get category items and create for each item button in Itemspanel but it really slow.

                DataRow[] rows = itemsData.Select("catID = '" + catID + "'");
                if(rows != null)
                    foreach (DataRow row in rows)
                        Button btn = new Button();
                        btn.Text = row["itemName"].ToString();
                        btn.Name = "item_" + row["itemID"].ToString();
                        btn.Height = 50;
                        btn.Width = 120;
                        btn.BackColor = Color.FromArgb(186, 185, 234);
                        btn.Click += (s, e) =>



This question does not have replies that have been liked.