DataGridView中的最大行数 [英] Max row count in DataGridView

查看:775
本文介绍了DataGridView中的最大行数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当count很大时,以下语句抛出Out of Memory异常(我看到这个为count = 44百万)(注意我使用虚拟模式只填充可见单元格)

dataGrid .RowCount = count;

我想修改如下:

试试{
dataGrid.RowCount = count;
} catch(OutOfMemoryException) {

//将计数设置为合理的值
count = rational_value;

ShowMessage("仅显示{0}行",计数);
dataGrid.RowCount = count;






我的问题是:这里合理的行数是多少。 datagridview的文档并没有将任何最大值放在数据网格可以拥有的行数上,但实际上存在内存限制。解决这个问题的最佳方法是什么?

The following statement throws an Out of Memory exception when count is large (I saw this for count = 44 million) (Note that I am using virtual mode to populate only the visible cells)

dataGrid.RowCount = count;

I want to modify this as follows :

try {
    dataGrid.RowCount = count;
} catch (OutOfMemoryException){

    // set count to reasonable value
    count = reasonable_value;

    ShowMessage ("Showing only {0} rows", count);
    dataGrid.RowCount = count;

}


My question is : What is a reasonable row count here. The documentation for datagridview doesnt put any max value on the row count a datagrid can have, but in practice there is a memory limitation. What is the best way to work around this problem

推荐答案

你好,pqr,44万?你有多少物理记忆? .NET不会限制行数的数量,我认为这是内存,操作系统会限制它。

真诚的,基拉茜
Hi pqr,

44 million? How much physical memory do you have? .NET won't limit the number of the rowcount, I think it is the memory and the operating system will limit that.

Sincerely,
Kira Qian


这篇关于DataGridView中的最大行数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆