Mark Mark - 1 month ago 22
C# Question

Slow to set DataGridView DataSource to DataTable in C#

I have a DataTable, fully populated, which I want to set to a DatagridView:

gdv.DataSource = dt;

However, this is painfully slow. The filling of the DataTable is very quick, but just this one line above takes ages. Is there any way to speed this up or perform it in another thread?

There is no interaction after this point. Just the simple statement above!



Check the formatting options, especially the Fill -related properties. Adjusting columnwidths for all rows involves a lot of calculation.