473,320 Members | 1,988 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Drag and drop from ListView and double click attempt

I am trying to do two things from a listview.

First is on a double click to perform an action on the object which was
double clicked. FullRowSelect is set to true for the Listview. Code for the
doubleClick event is:

Private Sub SongList_DoubleClick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles SongList.DoubleClick
If SongList.SelectedItems.Count = 0 Then
Exit Sub
End If
Dim ps As String = y + "\" + SongList.SelectedItems(0).Text
StartSong(ps)
End Sub

I also need to use the Listview as a source for DragDrop. To do this I have
to monitor when the mouse button is down so that the mouseMove event knows
what to do. The code for this is:

Private Sub SongList_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles SongList.MouseDown
_MouseDown = True
_MouseX = e.X
_MouseY = e.Y
End Sub

The mouseMove code is:

Private Sub SongList_MouseMove(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles SongList.MouseMove
If _MouseDown Then
If Math.Abs(_MouseX - e.X) > 5 Or Math.Abs(_MouseY - e.Y) > 5 Then
Exit Sub
End If
Dim xx As DataObject = New DataObject
Dim yy As ArrayList = New ArrayList
For Each li As ListViewItem In SongList.SelectedItems
yy.Add(y + "\" + li.Text)
Next
Dim zz As Array = yy.ToArray
xx.SetData("FileDrop", zz)
Try
SongList.DoDragDrop(xx, DragDropEffects.All)
_MouseDown = False
Catch ex As Exception
Dim zzz As Integer = 1
End Try
End If
End Sub

The problem is that the doubleClick event does not get called if I use the
MouseDown code. Commenting out the mouseDown code will allow the
doubleClick.

Any ideas?
Nov 21 '05 #1
0 1325

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Sam Martin | last post by:
hi all i have a user control which consumes the doubleclick event. when i use this control and implement drag and drop functionality, i.e. on mousedown check that the left button has been...
2
by: Dolorous Edd | last post by:
Hi, for a program I'm working on I need to be able to drag multiple files between Windows Explorer and a ListBox, in both directions. Implementing the "drag in" was pretty easy, but I can't find...
14
by: Nathan | last post by:
I'm working for the first time with the DoDragDrop method. I've got almost everything worked out, but I need some help with the last bit. There are two listboxes on my form, lstGroups and...
0
by: Lloyd Sheen | last post by:
In my application I have a ListView of files that meet certain criteria. I have implemented drag/drop from this list to a second ListView of selected items. This works well and will accept a...
3
by: VB Programmer | last post by:
In VB.NET 2005 (winform) any sample code to drag & drop items between 2 listboxes? Thanks!
2
by: TarheelsFan | last post by:
I am having problems with drag and drop into a listview. I am able to drag and drop items from within the listview, as well as drag items from the listview and drop into a picturebox. However, I...
1
by: Sim | last post by:
Hello NG, I try to use drag and drop function between two list views. For this I found following code: ...
0
by: jawilson | last post by:
Hello, I am trying to use drag-n-drop for a listview control in my program. I created a new listview control class (just call it MyListView) that inherits from ListView, and creates a few new...
2
by: Tom Bean | last post by:
I wrote an C# application that uses drag and drop to copy the contents of one ListViewItem to another. I call DoDragDrop() in the ItemDrag event handler, however, the ItemDrag event is being fired...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.