I Have a PowerShell form that contains a 'System.Windows.Forms.CheckedListBox'
object. Currently I am able to select more than one checkbox option at a time:
Is there a easy way of making the CheckedListBox
only allow one selection?
or will I have to use some 'onClick'
event logic within my script?
CheckListBox Proteries:
$checkedlistbox2.BackColor = 'Control'
$checkedlistbox2.BorderStyle = 'None'
$checkedlistbox2.CheckOnClick = $True
$checkedlistbox2.ColumnWidth = 56
$checkedlistbox2.FormattingEnabled = $True
[void]$checkedlistbox2.Items.Add("W2K")
[void]$checkedlistbox2.Items.Add("WXP")
[void]$checkedlistbox2.Items.Add("WS7")
$checkedlistbox2.Location = '107, 284'
$checkedlistbox2.MultiColumn = $True
$checkedlistbox2.Name = "checkedlistbox2"
$checkedlistbox2.SelectionMode = 'None'
$checkedlistbox2.Size = '192, 15'
$checkedlistbox2.TabIndex = 66
Have you tried changing the SelectionMode attribute to "One"?
Alternatively, you could use a radio button control, which allows only one selection at a time? Something like this: