Reputation: 304
I have a datagridview with dynamic checkbox
Dim checkBoxColumn As New DataGridViewCheckBoxColumn()
checkBoxColumn.HeaderText = ""
checkBoxColumn.Width = 30
checkBoxColumn.Name = "checkBoxColumn"
DataGridView1.Columns.Insert(0, checkBoxColumn)
I need to remove checkbox on the rows(0) and cells(0) I have tried
DataGridView1.Rows(0).Cells(0).Visible = False
but it's shown there is a readonly property
Upvotes: 0
Views: 133
Reputation: 5291
Here's a short C#
example on how to do that, shouldn't be hard to translate:
void dgv_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) {
DataGridView dgv = (DataGridView) sender;
if (e.RowIndex == 0 && e.ColumnIndex >= 0 && dgv.Columns[e.ColumnIndex] is DataGridViewCheckBoxColumn) {
e.PaintBackground(e.CellBounds, true);
e.Handled = true;
}
}
Upvotes: 1