Hi,
What is the easiest way to select all the items in a checked list box?
I wanted a checkbox called "select all" and when checked -eq $true, all the items in the list box are checked.
Cheers.
Select All Items in a CheckedListBox
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Select All Items in a CheckedListBox
Code: Select all
# check all items
(0..($checkedlistbox1.Items.Count -1)) | %{ $checkedlistbox1.SetItemChecked($_,$true)}
Re: Select All Items in a CheckedListBox
Cannot convert argument "index", with value: "VPN", for "SetItemChecked" to type "System.Int32": "Cannot convert value "VPN" to
ERROR: type "System.Int32". Error: "Input string was not in a correct format.""
I get the above for each item.
ERROR: type "System.Int32". Error: "Input string was not in a correct format.""
I get the above for each item.
Re: Select All Items in a CheckedListBox
Sorry -
Code: Select all
# check all items
(0..($checkedlistbox1.Items.Count -1)) | %{ $checkedlistbox1.SetItemChecked($_,$true)}