Listview Double Click

T

TexKiernan

I have a listview control in a subform. I also have a treeview in the parent
form. When I click a child node on the tree, the subform displays the
corresponding record and fills the listview with a list of files in a
specified folder. I need a double click to open the selected file. However,
I can only get the double click event to fire after I have been editing the
code for the form all other times, it fails? Code below:

Private Sub Listview0_DblClick()
Dim lListItem As ListItem

Set lListItem = ListView0.HitTest(sngListViewX, sngListViewY)
If (lListItem Is Nothing) Then
MsgBox "You did not double-click on a ListItem."
Else
MsgBox "You double-clicked on ListItem=" & lListItem.Text
End If
Set lListItem = Nothing
End Sub

Private Sub ListView0_MouseUp(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Long, ByVal Y As Long)
sngListViewX = X
sngListViewY = Y

End Sub
 
T

TexKiernan

It seems to not recognize that the I'm in the control. Could this be because
it is in a subform? Maybe because the parent has a treeview on it and the
x/y is locked up in the treeview?
 
T

TexKiernan

Because the main form has no records associated with it. I've tried and use
it in the main form but it was always one click behind.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top