tags:

views:

589

answers:

5

what is the maximum record count for a datagrid in vb.net? is there any limit?

+3  A: 

There is no explicit limitation in a DataGrid.

However it is constrained by both it's internal data structures which tend to count rows in terms of Integer. This means the hard limit is Integer.MaxValue

On a 32 bit system though, you will hit problems long before you hit Integer.MaxValue rows. Every item added to the DataGrid has a certain amount of overhead. If each item only has 4 bytes of overhead, you will max out at Integer.MaxValue / 4. This is really a simplistic view of the problem though because it doesn't take into account other controls, internal WinForms resources, etc ...

How many records are you thinking of adding?

JaredPar
+1  A: 

I'm not aware of any hard limit outside the physical limitations of available memory or perhaps Integer.MaxValue. I wouldn't be too surprised if there is, though.

What's more important is that a datagrid is a visual construct shown to real users. Users won't much appreciate a grid with 1000 items it, let alone 100,000+ (which I have seen before).

The point is that rather than worrying about the maximum records you can stuff in there, you're better off implementing paging or a better search mechanism.

Joel Coehoorn
A: 

The Count property of the DataGridView.Rows collection is an Integer, so the normal range for 4-byte signed integers should apply as an effective limit: 0 to 2,147,483,647

As to what the Rows collection can actually hold, I'm not sure... it would depend on what your application is actually doing.

Jim H.
A: 

Apart from Integer.MaxValue, I guess it depends on the memory available to the application & already used.

Why are you thinking of filling the grid with all rows at once?
It doesn't make sense showing users all the records.

shahkalpesh
A: 

How can you make the grid to show only (say 20) at a time and let the user to scroll through all records, using scroll bars, as in Oracle Forms. That is, at a time, the Grid will display only 20 adjesent records.