As per official documentation a
CheckBox.Checked Property (System.Windows.Forms)[
^] gets or set a
boolean
value.
Your code might be simplified to:
CheckBox11.Checked = itm.SubItems(1).Text.ToString.Contains("document")
Note: when you go trough the collection of
ListView2.Items
a
Checked
state of checkboxes is changing in every single step of
For Each ... Next
loop!
If you would like to change the state of checkbox on ListView item selection change, use
onClick
or
onSelectedIndexChange
event. See:
ListView Events (System.Windows.Forms)[
^]