WinForm中DataGrid(C#)应用 - 如何控制DataGrid显示规定行数.
来源:互联网 发布:淘宝首页热点链接 编辑:程序博客网 时间:2024/04/30 23:54
在编写程序的过程中,经常会用到DataGrid,并且需要控制DataGrid要其显示规定行数.
我们将DataGrid命名为:Grd, 规定Grd只能输入5行信息.
解决办法:
在Grd的单击事件里写如下代码即可
int iLineCount = 5;
if (((DataView)this.Grd.DataSource).Count > iLineCount )
{
((DataView)this.Grd.DataSource).AllowNew = false;
}
else
{
((DataView)this.Grd.DataSource).AllowNew = true;
}
具体代码就不具体分析了,估计大家肯定能看懂.
如果大家还有什么好的办法,请留言.有写的不对的地方请各位指正.谢谢。
- WinForm中DataGrid(C#)应用 - 如何控制DataGrid显示规定行数.
- 如何控制easyui datagrid显示
- 如何在WinForm中对DataGrid进行分页显示
- 如何在WinForm中对DataGrid进行分页显示
- 如何在WinForm中对DataGrid进行分页显示收藏
- datagrid 显示行数
- 【C#winform源码实例】datagrid显示主细表
- C#WinForm中打印DataGrid中的数据
- Flex中如何通过rowCount属性,动态改变DataGrid显示行数
- DataGrid显示的时间为什么没有“时、分、秒”?——WinForm中对DataGrid应用样式
- 绑定winform中DataGrid
- 控制Datagrid显示样式
- 如何在DataGrid中显示双标题
- wpf中的datagrid中如何显示图片
- DataGrid打印类(WinForm C#)
- DataGrid打印类(WinForm C#)
- VS2003中WinForm的datagrid上显示时间的解决方案
- DataGridRow 显示datagrid行数,不过会加慢速度
- 瞬间七月
- Web表格应用系统开发套件
- COM初探(一)
- 7月的最后3个星期在日立
- 在RHFC3下配置DNS Master 服务器
- WinForm中DataGrid(C#)应用 - 如何控制DataGrid显示规定行数.
- 突发异想,关于人体。
- 无 Cookie 的 ASP.NET
- 我们的生活, 我们的网——中国互联网历史长廊------中国互联网络信息中心(CNNIC)
- 【原创】STLport在Visual C++ 环境下的安装
- 模式和架构读书笔记
- csvde
- HttpContext.Current
- 当孤独成为一种习惯(转载)