我使用此代码求和所选单元格。哪里是信其工作良好,但是当用户selecte细胞引发异常:)我如何能确保当selectet细胞是字母不使之总结DataGridview中选定的单元格时出现的问题
-1
A
回答
1
private void dataGridView1_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
{
String filterStatus = DataGridViewAutoFilterColumnHeaderCell.GetFilterStatus(dataGridView1);
if (String.IsNullOrEmpty(filterStatus))
{
showAllLabel.Visible = false;
filterStatusLabel.Visible = false;
}
else
{
int result = -1;
Int32.TryParse(filterStatus, out result);
if (result != 0)
{
// it is a number
showAllLabel.Visible = true;
filterStatusLabel.Visible = true;
filterStatusLabel.Text = filterStatus;
}
else
{
// it can be a number yet won't help you with adding
}
}
}
0
这是我的代码
private void dataGridView1_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
{
String filterStatus = DataGridViewAutoFilterColumnHeaderCell.GetFilterStatus(dataGridView1);
if (String.IsNullOrEmpty(filterStatus))
{
showAllLabel.Visible = false;
filterStatusLabel.Visible = false;
}
else
{
showAllLabel.Visible = true;
filterStatusLabel.Visible = true;
filterStatusLabel.Text = filterStatus;
}
}
相关问题
- 1. 突出显示DataGridView中的选定单元格?
- 2. DataGridView单元格索引问题
- 3. DataGridView与CheckBox单元格问题
- 4. TableCellRenderer选中的单元格问题
- 5. 添加列时出现DataGridView问题
- 6. 访问EditedFormattedValue时Datagridview单元格变黑?
- 7. 确定DataGridView中的单元格位置
- 8. Java-结果总计出现问题
- 9. DataGridView默认行/单元格选择问题
- 10. 将选定的datagridview单元格存储在C#中的数组#
- 11. DataGridView单元格自定义
- 12. iOS桌面视图定制单元格出现问题
- 13. 如何检查Visual Basic中选定单元格的DataGridView列的标题文本
- 14. Winforms:验证datagridview中单元格的问题
- 15. 在tableview单元格上执行segue时出现问题
- 16. 访问列表中选定项目的值时出现问题
- 17. 防止在DataGridView中选择单元格
- 18. DataGridView怪异字符'q'问题自定义DataGridViewColumn单元格
- 19. 仅当选定行中的单元格非空白时出现的VBA代码
- 20. DataGridView单元格
- 21. UILongPressGestureRecognizer在表格视图单元格中使用时出现问题
- 22. 当我用颜色部分填充TableView单元格时,单元格中的文本出现问题
- 23. 访问单选按钮的OnChange javascript事件时出现问题
- 24. 如何在鼠标按住单元格时在DataGridView中维护选定的行?
- 25. DataGridView自定义单元格在选中时应该使用正常的ForeColor
- 26. 计算GridView单元格总数时出现异常
- 27. WinForms DataGridView单元格编辑结束事件获取单元格
- 28. 选中时突出显示单元格
- 29. 绑定源的DataGridView格式问题
- 30. DataGridView复制选定的行问题
邮编。接受更多答案。 – 2010-12-03 11:32:33