Add Item to checklistbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When I populate a checklistbox with Add method every item is showed equal to the others
I would show some item enabled, and some disabled......some item in black text and others in red text
Is possible

Thank yo
cos7
 
Hello,

Here are some suggestions:

1. Add new items that are already checked like this:
Me.DemoCheckedListBox.Items.Add("Corn", True)

2. Here is an example showing how to use the SetItemChecked method to check and uncheck boxes.

For i = 0 To Me.DemoCheckedListBox.Items.Count - 1

Select Case Me.DemoCheckedListBox.Items(i).ToString
Case "Carrot"
Me.DemoCheckedListBox.SetItemChecked(i, True)
Case "Rice"
Me.DemoCheckedListBox.SetItemChecked(i, False)
End Select
Next

3. Black and Red items - I haven't found a way to do this. Perhaps somone else can point you in the right direction. When I need to control appearance and have CheckBoxes too I use a ListView control with CheckBoxes.
 
cos75 said:
When I populate a checklistbox with Add method every item is showed
equal to the others. I would show some item enabled, and some
disabled......some item in black text and others in red text. Is
possible?

The listview (property checkboxes = true) might be the better control.
Supports individual color per row, but I don't think an enabled status per
row - but you can use a sort of disabled color and ignore things done with
those items.


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
Back
Top