DataGrid上的多选行

时间:2013-05-23 23:04:51

标签: vb.net vb.net-2010

我正在尝试为网格上出现的单个客户的每次出现选择DataGrid(gridActivePlayers)的整行。这是我的方法。我遇到'For Each'循环问题:

    Private Sub CustomerBindingSource_PositionChanged(sender As Object, e As EventArgs)  Handles CustomerBindingSource.PositionChanged
    Dim drvCustomer As DataRowView = CType(Me.CustomerBindingSource.Current, DataRowView)
    Dim selCustomer As Integer = drvCustomer.Item("CustomerID")

    ActivePlayersBindingSource.Position = Me.ActivePlayersBindingSource.Find("CustomerID", selCustomer)
' Here is what I need to implement
    For Each
        MsgBox(1)

    Next

End Sub

1 个答案:

答案 0 :(得分:1)

来自MSDN

  

要以编程方式选择行,请将其Selected属性设置为true。

有关详细信息,请参阅DataGridViewRow.Selected