簡體   English   中英

如何檢查在dataGridView中選擇了哪個單元格?

[英]How to check which cell in dataGridView is selected?

我想從dataGridView中的選定單元格發送多個郵件,但是不知道如何找出選中的單元格,所以問題是如何找出選中的單元格?

我可以做一些循環來遍歷單元格並測試選擇(選中)哪個單元格嗎?

語言C#。

使用DataGridView.SelectedCells屬性。

foreach(DataGridViewCell cell in dataGridView.SelectedCells)
{
    //do something
}
DataGridViewSelectedCellCollection selectedCells = myDataGridView.SelectedCells;

請參見以下示例: 如何:在Windows窗體DataGridView控件中獲取選定的單元格,行和列

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM