gpt4 book ai didi

vb.net - DataGridView 多行选择问题

转载 作者:行者123 更新时间:2023-12-04 15:01:09 25 4
gpt4 key购买 nike

我正在尝试使用 For... Next 循环检查 DataGridView 中的多个选择,但即使我选择了多行,唯一具有 Selected=True 属性的行是选择中的第一行。有没有解决的办法?

MultiSelect 在 DataGridView 上为 true。

我的代码如下:

For Each dr As DataGridViewRow In dgv.Rows
If dr.Selected = True Then
intSelectedRow = dr.Index
SetTime("KeyEntry", dgv.Name, intSelectedRow)
End If
Next

谢谢

最佳答案

尝试这个:

Dim selectedItems As DataGridViewSelectedRowCollection = dgv.SelectedRows
For Each selectedItem As DataGridViewRow In selectedItems
'Add code to handle whatever you want for each row
Next
End Sub

关于vb.net - DataGridView 多行选择问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14563807/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com