J Trahair
Well-known member
Hi all.
VB 2005, DataGridView. I have succeeded in giving all the cells in one column a checkbox - I can check them and uncheck them, no problem.
However, I would like some rows not to have a checkbox in that column (where the logic of having one there is wrong).
I have 2 procedures for dgvs - a SetupDgv procedure which displays a correctly headed dgv with blank rows, then a FillDgv procedure which just populates the rows. Currently the SetupDgv gives each cell in the column a tickbox - even the bottom few rows which are empty anyway.
The code I am using to show the checkboxes in SetupDgv is
where grd1 is the name of the dgv.
I would like to know how to 'turn off' a checkbox in the FillDgv procedure, as in
whilst populating each row. Of course, each FillDgv session may have different data and therefore checkboxes on different lines.
Thank you for any suggestions you can make.
VB 2005, DataGridView. I have succeeded in giving all the cells in one column a checkbox - I can check them and uncheck them, no problem.
However, I would like some rows not to have a checkbox in that column (where the logic of having one there is wrong).
I have 2 procedures for dgvs - a SetupDgv procedure which displays a correctly headed dgv with blank rows, then a FillDgv procedure which just populates the rows. Currently the SetupDgv gives each cell in the column a tickbox - even the bottom few rows which are empty anyway.
The code I am using to show the checkboxes in SetupDgv is
VB.NET:
Dim chk As New DataGridViewCheckBoxColumn
With chk
.Name = "4"
.Width = 50
.HeaderText = "Selected"
.DefaultCellStyle.NullValue = CheckState.Unchecked
.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
End With
grd1.Columns.Add(chk)
where grd1 is the name of the dgv.
I would like to know how to 'turn off' a checkbox in the FillDgv procedure, as in
VB.NET:
If mblnPathFileAndTagFromRootExists = True Then
strYN = "Y"
strFullLocalPath = mstrPathFileAndTagFromRoot
'Make col 4 have a checkbox. Done.
Else
strYN = ""
'Make col 4 NOT have a checkbox. Hmmmm.
'?????????
End If
whilst populating each row. Of course, each FillDgv session may have different data and therefore checkboxes on different lines.
Thank you for any suggestions you can make.