
A Question concerning draging into ListViews
Have a look at these:
'** This will update the ListItem text (with the label caption)
Private Sub ListView1_DragDrop(Source As Control, x As Single, y As Single)
Dim liHit As ListItem
If TypeOf Source Is Label Then
Set liHit = ListView1.HitTest(x, y)
If Not liHit Is Nothing Then
liHit.Text = Source.Caption
End If
End If
End Sub
'** This will highlight the drop target (assumes Single Selection)
Private Sub ListView1_DragOver(Source As Control, x As Single, y As Single,
State As Integer)
Dim liHit As ListItem
Set liHit = ListView1.HitTest(x, y)
If Not liHit Is Nothing Then
If Not liHit.Selected Then
liHit.Selected = True
ListView1.Refresh
End If
End If
End Sub
--
Good Luck,
Joe
Quote:
> Hello-
> I've got a form that has a label and a ListView. I want to be able to
drag
> the label onto the list view, and have it set the ListItem that it is over
> to the value of the label. I've got that part done and it works fine, but
> if I drag it over a part of the list view that does not have a ListItem I
> get an error. What kind of condition can I put to check to see if it will
> hit a ListItem?
> Thanks.
> -Steve