I am trying to set the checkbox to be grey. If the user clicks one box and its arguments over ride the other boxes then those will be greyed, but I have searched everywhere for this and cant find it, anyone have a solution? All i have seen was indeterminate but it doesnt necessarily grey it out, i dont like this

Recommended Answers

All 3 Replies

A checkbox control's value is a tri-state value: unchecked, checked or indeterminate. In code that is one of the following CheckStates:

CheckBox1.CheckState = CheckState.Unchecked
CheckBox1.CheckState = CheckState.Checked
CheckBox1.CheckState = CheckState.Indeterminate

where CheckState.Indeterminate means "greyed-out" value.

All i have seen was indeterminate but it doesnt necessarily grey it out, i dont like this

Perhaps you should explain this further if CheckBox1.CheckState = CheckState.Indeterminate is not what you're looking for.

I am trying to set the checkbox to be grey. If the user clicks one box and its arguments over ride the other boxes then those will be greyed, but I have searched everywhere for this and cant find it, anyone have a solution? All i have seen was indeterminate but it doesnt necessarily grey it out, i dont like this

Hi,

Here's is a small example how you can change the Backcolor by checking a checkbox.

Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
        If CheckBox1.Checked Then
            CheckBox2.BackColor = Color.Gray
        End If
    End Sub

If that isn't the case, you can perhaps explain a little more what your do you mean with arguments.

I did however seem to fix my issue, I appreciate the help, I just set:

Select Case CheckBox2.Checked
            'Is Checked
            Case True
                CheckBox1.Enabled = False 'Disable Checkbox 1
                CheckBox4.Enabled = False 'Disable Checkbox 4   
                '--------------------------------------------
                CheckBox1.Checked = False 'Uncheck Checkbox 1
                CheckBox4.Checked = False 'Uncheck Checkbox 4

                'Is NOT Checked
            Case False
                CheckBox1.Enabled = True 'Enable Checkbox 1
                CheckBox2.Enabled = True 'Enable Checkbox 2
                CheckBox3.Enabled = True 'Enable Checkbox 3
                CheckBox4.Enabled = True 'Enable Checkbox 4
                '--------------------------------------------
                CheckBox1.Checked = False 'Uncheck Checkbox 1
                CheckBox2.Checked = False 'Uncheck Checkbox 2
                CheckBox3.Checked = False 'Uncheck Checkbox 3
                CheckBox4.Checked = False 'Uncheck Checkbox 4
        End Select

I know the checkbos doesnt grey out but it completely disables the checkbox, unchecks it and greys out the label, but the label can still be read. Sweet!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.