datagridview hide checkbox?

I have a datagridview checkbox column. How do I make some of them invisible? Alternatively, how do I only make specific cells checkbox?

I want a checkbox column with some cells looking empty. I already have those rows read-only.
Who is Participating?
PizpotConnect With a Mentor Author Commented:
Here is what I did.  I already set these rows readonly with

DataGridView1.Rows(r).ReadOnly = True

All I needed was an array of which rows to hide the checkboxes in.
   Private Sub DataGridView1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles DataGridView1.Paint
        'Hide Checkboxes:
        Dim r As Integer
        Dim rect As Rectangle
        For r = 0 To bundle_count_g - 1
            If row_status(r) = "erase" Then
                rect = DataGridView1.GetCellDisplayRectangle(8, r, True)
                e.Graphics.FillRectangle(Brushes.LightGray, rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 2)
            End If
        Next r
    End Sub

Open in new window

To hide a datagridview-column

        DataGridView1.AutoGenerateColumns = True;
        DataGridView1.DataSource = ds;
        DataGridView1.DataMember = "TableName";
        //DataGridView1.DataMember = ds.Tables[0].TableName;

        DataGridView1.Columns[0].Visible = False;
PizpotAuthor Commented:
I bet you could draw over the checkboxes!?!
The new generation of project management tools

With’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Can you please clarify your previous comment (and the reason why it should be accepted !)
PizpotAuthor Commented:
Yes. A possible solution would be to draw an area of pixels over the checkboxes, and make them read-only so that they do nothing and are invisible.

The suggestion in the 2nd post, to make the whole column invisible does not answer the question. Not every row, just some!
Closed, 300 points refunded.
Community Support Moderator
All Courses

From novice to tech pro — start learning today.