>I need to build and display a huge data grid (roughly 5000x5000). (I know
>it is difficult to view, but i need to do it anyway)
the immediate problem i am facing is that it takes a VERY long time to add
5000 columns. i created an array of DataGridViewTextBoxColumn[] and called
DataGridView Columns.AddRange(array). This still takes a VERY long time. i
haven't even attempted to add the 5000 rows or calculate the values of
each cell (25M of them)
is there a trick that i am overlooking on how to manage this?
But there must be a better way. it makes more sense to display the headers
and rows and calculate the value of the cells as they become visible
rather doing the whole thing up front. is there a way to do this? or do i
need to use a third party product?
The number of columns you're dealing with is completely unreasonable IMO (do
you really "need" to do it) but in any case, you can check out its
"VirtualMode" property though it doesn't address the number of columns
(which you should handle dynamically anyway). IMO however, you may wish to
consider a 3rd-party product instead. I normally hate to resort to this
since I generally distrust most products on the market outside of MSFT.
However, the "DataGridView" has been an enormous source of problems for me
personally after more than a year of very intense work with it (and a lot of
research into improving its performance - note that even one MSFT blogger
acknowledged the problem based on the use of slower API functions compared
to the older "DataGrid" control - perhaps you should check that control out
instead though I've never used it myself). In any case, the performance can
be very, very poor as you've now discovered (depending on various factors)
but moreover, there are some (potentially) difficult programming issues with
the control in general depending on what you're up to (which I won't get
into here). MSFT no doubt spent a lot of time designing this control and it
certainly shows. It has a lot of power and flexibility but there are still
some serious issues that need to be worked out IMO (performance being a
major one).