D
Dean Slindee
In a checked listbox, I am allowing drag/drop of the items within
(resequencing). Problem is, when dropping a checked item, the checked state
always reverts to unchecked (unwanted). Anyone know how to set the checked
state of a checked listbox item in code. Here is the drag/drop code, which
works fine, except for unchecking the dropped item:
Private Sub clbQueryItems_DragDrop(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.DragEventArgs) Handles clbQueryItems.DragDrop
'ensures that the list item index is contained in the data.
If (e.Data.GetDataPresent(GetType(System.String))) Then
Dim item As Object = CType(e.Data.GetData(GetType(System.String)),
System.Object)
'perform drag and drop, depending upon the effect.
If (e.Effect = DragDropEffects.Copy Or _
e.Effect = DragDropEffects.Move) Then
'insert the item.
If (indexDropItem <> CheckedListBox.NoMatches) Then
clbQueryItems.Items.Insert(indexDropItem, item)
Else
clbQueryItems.Items.Add(item, True)
End If
End If
End If
End Sub
Thanks in advance,
Dean Slindee
(resequencing). Problem is, when dropping a checked item, the checked state
always reverts to unchecked (unwanted). Anyone know how to set the checked
state of a checked listbox item in code. Here is the drag/drop code, which
works fine, except for unchecking the dropped item:
Private Sub clbQueryItems_DragDrop(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.DragEventArgs) Handles clbQueryItems.DragDrop
'ensures that the list item index is contained in the data.
If (e.Data.GetDataPresent(GetType(System.String))) Then
Dim item As Object = CType(e.Data.GetData(GetType(System.String)),
System.Object)
'perform drag and drop, depending upon the effect.
If (e.Effect = DragDropEffects.Copy Or _
e.Effect = DragDropEffects.Move) Then
'insert the item.
If (indexDropItem <> CheckedListBox.NoMatches) Then
clbQueryItems.Items.Insert(indexDropItem, item)
Else
clbQueryItems.Items.Add(item, True)
End If
End If
End If
End Sub
Thanks in advance,
Dean Slindee