0
Dim index As Integer = DataGridView1.Rows.Count - 1
For Each row As DataGridViewRow In DataGridView1.Rows
       'Do events..
        row.Cells(1).Value = "Loading.."
        row.ReadOnly = True
Next

对不起我的英语有点。我的 gridview 编辑和删除已启用。我想要:如果单元格值为“正在加载..”,则此行不会被用户选择或删除。感谢帮助。

4

1 回答 1

0

OnEvent: UserDeletingRow 你可以取消它:示例。

Private Sub DataGridView1_UserDeletingRow(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewRowCancelEventArgs) Handles DataGridView1.UserDeletingRow
        If (e.Row.Cells(1).Value = "loading") Then
            e.Cancel = True
        End If

End Sub
于 2013-11-14T23:45:26.040 回答