473,385 Members | 1,320 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,385 software developers and data experts.

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_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles frombox3.MouseDown

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

Dim Index As Integer

frombox3 = sender

Index = frombox3.IndexFromPoint(Pt)

If Index >= 0 Then

frombox3.DoDragDrop(frombox3.Items(Index), DragDropEffects.Move)

End If

End Sub

Private Sub tobox3_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles tobox3.MouseDown

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

Dim Index As Integer

tobox3 = sender

Index = tobox3.IndexFromPoint(Pt)

If Index >= 0 Then

tobox3.DoDragDrop(tobox3.Items(Index), DragDropEffects.Move)

End If

End Sub

Private Sub frombox3_DragDrop(ByVal sender As Object, ByVal e As
System.Windows.Forms.DragEventArgs) Handles frombox3.DragDrop

frombox3.Items.Add(e.Data.GetData(DataFormats.Text ).ToString)

tobox3.Items.Remove(e.Data.GetData(DataFormats.Tex t).ToString)

End Sub

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

tobox3.Items.Add(e.Data.GetData(DataFormats.Text). ToString)

frombox3.Items.Remove(e.Data.GetData(DataFormats.T ext).ToString)

End Sub

Private Sub tobox3_DragEnter(ByVal sender As Object, ByVal e As
System.Windows.Forms.DragEventArgs) Handles tobox3.DragEnter

Dim x As Integer

x = tobox3.FindStringExact(e.Data.GetData(DataFormats. Text).ToString, -1)

If x <> -1 Then

Exit Sub

End If

If (e.Data.GetDataPresent(DataFormats.Text)) Then

e.Effect = DragDropEffects.Move

Else

e.Effect = DragDropEffects.None

End If

End Sub

Private Sub frombox3_DragEnter(ByVal sender As Object, ByVal e As
System.Windows.Forms.DragEventArgs) Handles frombox3.DragEnter

Dim x As Integer

x = frombox3.FindStringExact(e.Data.GetData(DataFormat s.Text).ToString, -1)

If x <> -1 Then

Exit Sub

End If

If (e.Data.GetDataPresent(DataFormats.Text)) Then

e.Effect = DragDropEffects.Move

Else

e.Effect = DragDropEffects.None

End If

End Sub


Nov 21 '05 #1
0 1255

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

Similar topics

11
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...
1
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...
3
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...
1
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...
0
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...
0
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...
2
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...
0
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...
1
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...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.