473,790 Members | 3,185 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

drag-drop from one listbox to another

OK, I have drag-drop working between one listbox and another (and back) with
the code below.

But I can't get it to work when I change the selection mode to multi or
multi extended.

Any help would be much appreciated.

Bernie
Private Sub frombox3_MouseD own(ByVal sender As Object, ByVal e As
System.Windows. Forms.MouseEven tArgs) Handles frombox3.MouseD own

Dim Pt As New Point(e.X, e.Y)

Dim Index As Integer

frombox3 = sender

Index = frombox3.IndexF romPoint(Pt)

If Index >= 0 Then

frombox3.DoDrag Drop(frombox3.I tems(Index), DragDropEffects .Move)

End If

End Sub

Private Sub tobox3_MouseDow n(ByVal sender As Object, ByVal e As
System.Windows. Forms.MouseEven tArgs) Handles tobox3.MouseDow n

Dim Pt As New Point(e.X, e.Y)

Dim Index As Integer

tobox3 = sender

Index = tobox3.IndexFro mPoint(Pt)

If Index >= 0 Then

tobox3.DoDragDr op(tobox3.Items (Index), DragDropEffects .Move)

End If

End Sub

Private Sub frombox3_DragDr op(ByVal sender As Object, ByVal e As
System.Windows. Forms.DragEvent Args) Handles frombox3.DragDr op

frombox3.Items. Add(e.Data.GetD ata(DataFormats .Text).ToString )

tobox3.Items.Re move(e.Data.Get Data(DataFormat s.Text).ToStrin g)

End Sub

Private Sub tobox3_DragDrop (ByVal sender As Object, ByVal e As
System.Windows. Forms.DragEvent Args) Handles tobox3.DragDrop

tobox3.Items.Ad d(e.Data.GetDat a(DataFormats.T ext).ToString)

frombox3.Items. Remove(e.Data.G etData(DataForm ats.Text).ToStr ing)

End Sub

Private Sub tobox3_DragEnte r(ByVal sender As Object, ByVal e As
System.Windows. Forms.DragEvent Args) Handles tobox3.DragEnte r

Dim x As Integer

x = tobox3.FindStri ngExact(e.Data. GetData(DataFor mats.Text).ToSt ring, -1)

If x <> -1 Then

Exit Sub

End If

If (e.Data.GetData Present(DataFor mats.Text)) Then

e.Effect = DragDropEffects .Move

Else

e.Effect = DragDropEffects .None

End If

End Sub

Private Sub frombox3_DragEn ter(ByVal sender As Object, ByVal e As
System.Windows. Forms.DragEvent Args) Handles frombox3.DragEn ter

Dim x As Integer

x = frombox3.FindSt ringExact(e.Dat a.GetData(DataF ormats.Text).To String, -1)

If x <> -1 Then

Exit Sub

End If

If (e.Data.GetData Present(DataFor mats.Text)) Then

e.Effect = DragDropEffects .Move

Else

e.Effect = DragDropEffects .None

End If

End Sub


Nov 21 '05 #1
0 1284

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

Similar topics

11
1598
by: kiran | last post by:
I am trying to implement a rubber band/image selection script. For that I need to remove the default drag behaviour on an image. I am able to do this in IE but not Netscape. Does any one have a solution? Pls look below for IE code: var moz = ((document.all)? false : true); var ie = ((document.all)? true : false); var ElementUtil = new Object(); ElementUtil.addEventListener = function(o, type, handler) {
1
1560
by: kiran | last post by:
I am trying to implement a rubber band/image selection script. For that I need to remove the default drag behaviour on an image. I am able to do this in IE but not Netscape. Does any one have a solution? Pls look below for IE code: var moz = ((document.all)? false : true); var ie = ((document.all)? true : false); var ElementUtil = new Object(); ElementUtil.addEventListener = function(o, type, handler) {
3
2756
by: NewSun | last post by:
How can i drag a datarow from a datagrid to a other control? e.g. Drag a datarow from a datagrid to a TextBox,Then display one colnumn' value of the datarow . Or Drag a cell's value to a controll and display/handle the value in the other controll. Thanks in advance.
1
371
by: Jon Cosby | last post by:
I need an event handler for dragging the cursor on a PictureBox. The existing events only include handlers for dragging and dropping objects over the controls. I'm trying to use the MouseDown and MouseUp handlers as below, but it never gets out of the while loop. this.PicBox.MouseDown += new MouseEventHandler(this.StartMapDrag); this.PicBox.MouseUp += new MouseEventHandler(this.EndMapDrag); private void StartMapDrag(object sender,...
0
305
by: Samuel R. Neff | last post by:
I have a typical TreeView/ListView combo and can drag from the ListView to the TreeView. I'd like to select the TreeView node that is the target of the drag operation as the ListView items are dragged around the tree. I haven't found a way to do this. Apparently TreeView.MouseMove isn't fired during the drag operation. Any suggestions or examples?
0
1058
by: david | last post by:
Yesterday I got a suggestion about the web page layout from Stas. Thanks, Stas. However, I have a problem to drag the existing radio buttons into the table cell. Case: I have a lot of radion buttons in web form. Since those radio buttons and textboxes and text would overlap each other, when a client user use large size in his web browser. Stas's suggestion is to use table. I insert a panel into the design pane and then a table into the...
2
4902
by: vunet.us | last post by:
Hello JavaScript experts, I have a floating div which I drag all over the page. If the page has scrollbars and users drag the floating div to the very top, page scrolls up too. The problem occurs at this moment. As page scrolls up, the div gets detached from the mouse while dragging. How can I keep the floating div to always stay attached to the mouse during a dragging process and scrolling the page? Plug and Play code is a good example...
0
1112
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
Being you can drag webparts from zone to zone, is there a way to control drag speed while dragging/scrolling up the page? I have a list of webparts that may go beyond the page. If a user wants to drag the bottom webpart up to the top, I was wondering if the speed of this drag/scroll action can be controlled. Thanks
0
9512
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
10419
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10201
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
10147
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
9023
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
7531
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
6770
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
5424
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3709
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.