Skip to main content
 首页 » 编程设计

c#之如何检查选中了dataGridView中的哪个单元格

2024年02月20日19softidea

我想从 dataGridView 中的选定单元格发送多个邮件,但不知道如何找出哪些单元格被选中,所以问题是如何找出哪些单元格被选中?

我可以做一些循环来遍历单元格并测试选择(选中)哪个单元格吗?

C# 语言。

请您参考如下方法:

DataGridViewSelectedCellCollection selectedCells = myDataGridView.SelectedCells; 

查看示例:How to: Get the Selected Cells, Rows, and Columns in the Windows Forms DataGridView Control