在DataGridView里有一列是数字字段,如果该值是零,就不显示,或显示为空,如何设置?
0.00;0都不让它显示或为空。
0.00;0都不让它显示或为空。
解决方案 »
- 关于“VS2008试用期评估已经结束。”问题
- 遍历文件夹,有10万张图片,把地址插入mysql中,用什么方法快。
- 正则表达式
- access 里什么类型最长 速结
- treeview 单表 两列菜单 C#
- 如何知道给定IP地址的一台服务器,是否提供某种指定的服务?
- C#.net 求 用存储过程 实现 GRIDVIEW 分页 全过程(存储过程,前台,后台)
- NETFramework4.0 的DLL可以不配置config文件吗
- 【在线等】请教关于异步传输的理解
- 非常简单的几个问题
- 关于c#的几个问题?哪位大虾看看啊。。。
- C# winfrom程序 用户登陆后如何记住用户的ID等信息?有没有像web中的session
{
for (int i = 0; i < dataGridView1.RowCount;i++)
{
for(int j=1;j <4;j++)
if (dataGridView1.Rows[i].Cells[j].Value = 0)
{
dataGridView1.Rows[i].Cells[j].Value= "";
}
}
}
结贴吧
private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
for (int i = 0; i < dataGridView1.RowCount;i++)
{
for(int j=1;j <4;j++)
if (dataGridView1.Rows[i].Cells[j].Value == "0" ||dataGridView1.Rows[i].Cells[j].Value == "0.00")
{
dataGridView1.Rows[i].Cells[j].Value= "";
}
}
}
在VFP里format属性设为'Z'就行了,C#有没有这样的属性?
if (Convert.ToInt32(dataGridView1.Rows[i].Cells[j].Value) == 0)
{
dataGridView1.Rows[i].Cells[j].Value= "";
}