Hey guys, I need some help with the logic on coding a checkbox column on a Datagrid on a Windows Form. What I want the Datagrid to do, is once the checkbox is checked on the Datagrid, to enable several other columns also on the Datagrid. I think I almost have it, but I cannot figure out how to id the checkbox.

Right now I can get the column, by checking the currentcell.rowindex and columnindex on the MouseUp event of the Datagrid, but how do I identify the actual checkbox and if it is checked or not?

Thanks

Recommended Answers

All 3 Replies

Thanks, that got me started, but I still have one problem; Right now I am checking the checkbox column, and if its checked, setting several columns ReadOnly to false, but I cant get it to immediately save the settings in that row. The columns that get set to False only become active when another checkbox is checked. Any suggestions? Heres the code I have now:

Private Sub Grid1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Grid1.MouseUp
        If Grid1.SelectedCells(0).ColumnIndex = 0 Then
            For Each dgRow As DataGridViewRow In Grid1.Rows
                If dgRow.Cells(0).FormattedValue = True Then
                    dgRow.Cells(1).ReadOnly = False
                    dgRow.Cells(3).ReadOnly = False
                    dgRow.Cells(6).ReadOnly = False
                    Grid1.Update()
                    Grid1.Refresh()
                Else
                    dgRow.Cells(1).ReadOnly = True
                    dgRow.Cells(3).ReadOnly = True
                    dgRow.Cells(6).ReadOnly = True
                    Grid1.Update()
                    Grid1.Refresh()
                End If

            Next

        End If
    End Sub

anyone?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.