网格值状态下的复选框列

时间:2015-11-25 14:19:43

标签: vb.net checkbox datagridview

无论我尝试什么,都不会选择1 =检查的值。

是否有其他方法可以选中已选中的复选框值并将其传递给函数_monitoringcheck

Private Sub dgv2_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgv2.CellContentClick
    Dim senderGrid = DirectCast(sender, DataGridView)

    Dim _idTabele As Long

    If bsDgv3.Position >= 0 And bsDgv3.Position < Dgv3.Rows.Count Then
        _idTabele = Me.Dgv3.Rows(bsDgv3.Position).Cells("dgv3_id").Value
    End If

    If TypeOf senderGrid.Columns(e.ColumnIndex) Is DataGridViewCheckBoxColumn AndAlso e.RowIndex >= 0 AndAlso senderGrid.Columns(e.ColumnIndex).Name = "chkStatus" Then
        Dim strValue As Integer
        If dgv2.Columns(e.ColumnIndex).Name = "chkStatus" Then
            Try
                strValue = Me.dgv2.Item(e.ColumnIndex, e.RowIndex).Value
            Catch ex As Exception
                strValue = 0
            End Try
            cl._MonitoringCheck(Math.Abs(CInt(strValue)), _idTabele)
        End If
    End If
End Sub

即使我包含&#34;脏检查&#34;

  Sub dataGridView1_CurrentCellDirtyStateChanged(ByVal sender As Object, ByVal e As EventArgs) Handles Dgv3.CurrentCellDirtyStateChanged
    If Dgv3.IsCurrentCellDirty Then
        Dgv3.CommitEdit(DataGridViewDataErrorContexts.Commit)
    End If
End Sub

0 个答案:

没有答案