我如何检查datagridview是否选择了任何单元格。 [英] How can i check datagridview any cell are selected or not.
本文介绍了我如何检查datagridview是否选择了任何单元格。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何检查datagridview是否选择了任何单元格。
How can i check datagridview any cell are selected or not.
推荐答案
DataGridView有一个名为SelectedCells的属性,它返回用户选择的单元格集合。 br />
或者你可以检查下面单元格的选定属性
DataGridView has a property Called SelectedCells which returns the collection of cells selected by the user.
or you can check the Selected Property of cell like below
this.dataGridView1.Rows[0].Cells[0].Selected;//true/false
我解决了自己......
I solve my self......
if (dataGridView1.SelectedCells.Count>0)
{
//True statement
}
else
{
//False statement
}
if(dataGridview1.CurrentCell!= null )
{
//在这里做点什么
}
if(dataGridview1.CurrentCell != null)
{
// DO something here
}
这篇关于我如何检查datagridview是否选择了任何单元格。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文