mardi 21 mars 2017

Set Datagridview CheckBox State to Indeterminate

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 don´t worked in the end....

Thanks in advance!

Sincerly,

T.S




Aucun commentaire:

Enregistrer un commentaire