0

Possible Duplicate:
How to disable a checkbox in a checkedlistbox?

I'm looking at trying to disable a checkboxlist item if another item is checked. The handling of this is easy however I'm struggling on actually disabling a particular item. There seems to be no enabled function in Items property so I'm unsure how to disable specific items.

If CheckedListBox1.GetItemChecked("0") = True Or 
       CheckedListBox1.GetItemChecked("1") = True Then
                CheckedListBox1.Items(0).enabled=false
    ElseIf CheckedListBox1.GetItemChecked("0") = false AND 
       CheckedListBox1.GetItemChecked("1") = false Then
        CheckedListBox1.Items(0).enabled=true

Any help greatly appreciated

Thanks

Community
  • 1
  • 1
rmon2852
  • 220
  • 1
  • 7
  • 19
  • also: http://social.msdn.microsoft.com/forums/en-US/winforms/thread/097d6baa-f924-45eb-8d64-f5baacf110f0 and http://www.dotnettechy.com/problem-solutions/disabling-an-item-in-a-checkedlistbox-c-winform-10.aspx – sloth Sep 11 '12 at 09:31

1 Answers1

0

I've done this:

     Private Sub checkbox1_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles checkbox1.CheckedChanged

    If checkbox1.Focused = True Then
        checkbox1.Checked = True
    End If
    checkbox2.Checked = False
    checkbox3.Checked = False
    checkbox4.Checked = False
    checkbox5.Checked = False
    checkbox6.Checked = False
End Sub

and switch on every checkbox. Next will be checkbox2 in de checkbox 2 Sub.

deltu100
  • 581
  • 7
  • 26
  • This is for checkboxes rather than checkboxlists, however I've found it can't be done with checkbox lists so i've changed to checkboxes and put in a panel and used your method – rmon2852 Sep 12 '12 at 10:20
  • Oh sorry did not read correctly then. I will look into it when i get some more time – deltu100 Sep 13 '12 at 08:00