【发布时间】:2012-05-15 18:38:19
【问题描述】:
我想从dataGridView中的选定单元格发送多个邮件,但不知道如何找出哪些单元格被选中,所以问题是如何找出哪些单元格被选中?
我可以做一些循环来遍历单元格并测试选择(检查)哪个单元格吗?
语言 c#。
【问题讨论】:
标签: c# select datagridview
我想从dataGridView中的选定单元格发送多个邮件,但不知道如何找出哪些单元格被选中,所以问题是如何找出哪些单元格被选中?
我可以做一些循环来遍历单元格并测试选择(检查)哪个单元格吗?
语言 c#。
【问题讨论】:
标签: c# select datagridview
使用DataGridView.SelectedCells 属性。
foreach(DataGridViewCell cell in dataGridView.SelectedCells)
{
//do something
}
【讨论】:
DataGridViewSelectedCellCollection selectedCells = myDataGridView.SelectedCells;
查看示例:How to: Get the Selected Cells, Rows, and Columns in the Windows Forms DataGridView Control
【讨论】: