473,769 Members | 2,214 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_Double Click(ByVal sender As Object, ByVal e As
System.EventArg s) Handles SongList.Double Click
If SongList.Select edItems.Count = 0 Then
Exit Sub
End If
Dim ps As String = y + "\" + SongList.Select edItems(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_MouseD own(ByVal sender As Object, ByVal e As
System.Windows. Forms.MouseEven tArgs) Handles SongList.MouseD own
_MouseDown = True
_MouseX = e.X
_MouseY = e.Y
End Sub

The mouseMove code is:

Private Sub SongList_MouseM ove(ByVal sender As Object, ByVal e As
System.Windows. Forms.MouseEven tArgs) Handles SongList.MouseM ove
If _MouseDown Then
If Math.Abs(_Mouse X - e.X) > 5 Or Math.Abs(_Mouse Y - 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.Select edItems
yy.Add(y + "\" + li.Text)
Next
Dim zz As Array = yy.ToArray
xx.SetData("Fil eDrop", zz)
Try
SongList.DoDrag Drop(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 1354

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

Similar topics

4
4826
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 pressed, the DoDragDrop(... Problem is, because DoDragDrop is always called when the left Mouse button is pressed, the double click in the user control isn't being fired? any ideas?
2
3127
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 a way to export more than on item at time. The ideal result would be to be able to drag the selected files, but as soon as I click on the LB to do the drag a new selection is made that cancels the current one and by searching with google it...
14
2176
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 lstStudents. I want to be able to drag a name from lstStudents and drop it on one of the names in lstGroups to move it to that group. I've got the dragging part working; it's just the dropping that isn't there yet. I'm working with what I can find...
0
1247
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 filelist from windows explorer. Now I want to be able to drag the selected items in the second ListView (selected by checkbox) to an external application such as Media Player. In my DataObject created to do the drag and drop internally I create an...
3
10598
by: VB Programmer | last post by:
In VB.NET 2005 (winform) any sample code to drag & drop items between 2 listboxes? Thanks!
2
9710
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 am not able to drag the text or image from the picturebox to the listview. In the listview_dragenter function, I have e.Effects = DragDropEffects.Copy (I have also tried e.Effects = DragDropEffects.Move, but it does not help either), which is...
1
5375
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: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchimpdragdrop.asp It works fine, but I have another problem. I want to create functionality like a Windows Explorer. This means, if I select some items from list view No 1 and drag&drop this to the list view No 2, then I want to mark automatically
0
2179
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 properties and methods. I have set AllowDrop to true, and have all of the Drag* events written. In addition, the listview is in the detailed view. A simple explanation of what I want to do is to drag a file from the desktop or explorer into my...
2
3471
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 when an item in the ListView is clicked to select it instead of being fired when the item is dragged. This is causing a problem when users click on an item and move the moue (after the mouse button has been released) because the app tries to...
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9422
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10035
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9984
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8863
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7403
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2811
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.