I have a Datagridview which is set to readonly and programmically set to checked / unchecked / indeterminate. However, checked and uncheck options work fine, but the indeterminate state is not working at all. The code example is included in a cellcontentclick handler.
If Not temp_man_pos = Nothing And Not temp_man_neg = Nothing Then
If temp_abweichung <= temp_man_pos And temp_abweichung >= (-(temp_man_neg)) And Not temp_man_pos = Nothing And Not temp_man_neg = Nothing Then
Me.DataGridView1.Rows(x).Cells("KAL_Measuring_Data_Result_1").Value = CheckState.Checked
' Me.DataGridView1.Rows(x).Cells("KAL_Measuring_Data_Result_1").Value = 1
Else
Me.DataGridView1.Rows(x).Cells("KAL_Measuring_Data_Result_1").Value = CheckState.Unchecked
' Me.DataGridView1.Rows(x).Cells("KAL_Measuring_Data_Result_1").Value = 0
End If
Else
Me.DataGridView1.Rows(x).Cells("KAL_Measuring_Data_Result_1").Value = CheckState.Indeterminate
End If
In the Datagridview Options, the True Value is manually set to 1, the false to 0 and indeterminate to 2, which should be the same value like checkstate.indeterminate.
I also tried with tristate option but the .usedefault value is displayed as checked in the checkbox.
Me.DataGridView1.DefaultCellStyle.WrapMode = DataGridViewTriState.True
Me.DataGridView1.Rows(x).Cells("KAL_Measuring_Data_Result_1").ValueType = GetType(TriState)
Me.DataGridView1.Rows(x).Cells("KAL_Measuring_Data_Result_1").Value = TriState.UseDefault
True and False Values are working great though.
What am I doing wrong?

Indeterminatevalue will always display as checked unlessTriStateis set to true in which case the value should display as a solid box inside the check box. Again it is not clear exactly what the problem is. - JohnG