473,403 Members | 2,222 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,403 software developers and data experts.

ListBox Drag and Drop

I'm trying to implement Drag and Drop with objects in list boxes and I'm not having any success. I can drag and drop strings, but when I try to change the code to drag an object it allows me to pick up the object and the mouse changes when I get over a place that will accept the drop but when I let go of the mouse button it sits there for about 3 seconds then the mouse turns to the normal pointer and the object isn't listed in the drop listBox but is also gone from the place I dragged it from. Following is my code unsuccessfull code

private void box1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e

if(box1.Items.Count==0
return
int index = box1.IndexFromPoint(e.X,e.Y)
SchedStudent s = (SchedStudent)box1.Items[index]

DragDropEffects dde1=DoDragDrop(s, DragDropEffects.All)
if(dde1 == DragDropEffects.All
{
box1.Items.RemoveAt(box1.IndexFromPoint(e.X,e.Y));
}
private void box2_DragDrop(object sender, System.Windows.Forms.DragEventArgs e

SchedStudent str= (SchedStudent)e.Data
box2.Items.Add("test")
private void box2_DragOver(object sender, System.Windows.Forms.DragEventArgs e

e.Effect = DragDropEffects.All
Nov 15 '05 #1
0 1557

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

Similar topics

4
by: John Guarnieri | last post by:
Hi All, I need some code to drag items in a list box either up or down along with not just the text but with the itemdata too. Can anyone hook me up? TIA John
5
by: CoolWriter | last post by:
Hi, How can I drag and drop the items of a ListBox? For example, how can I drag the first item to the third items position in a ListBox? Thanks.
3
by: James Radke | last post by:
Hello, I was curious, is it possible to create drag and drop interface from listbox to listbox on a webform application (i.e. vb.net)? Basically the application would need to load multiple...
3
by: Dean Slindee | last post by:
In a checked listbox, I am allowing drag/drop of the items within (resequencing). Problem is, when dropping a checked item, the checked state always reverts to unchecked (unwanted). Anyone know...
1
by: Zyrthofar Blackcloak | last post by:
Hi everyone I have a listbox with more items in it than is printed on screen. I need the index number of the first shown item to move another listbox to the same position... Explained differently,...
1
by: andrew nott | last post by:
Can anyone tell the the recommended way of performing mutiple-item drag-n-drop from a MultiExtended listbox? The problem is the ListBox selection isn't completed in the MouseDown event, when the...
11
by: John Dann | last post by:
I'm still struggling to find a way of reordering the items within the same single listbox with drag and drop. I think I've got the drag working but it's the drop code I can't figure out. What I...
3
by: thomasp | last post by:
Has anyone got some sample code to do drag and drop from one listbox to another listbox using VB.Net 2005. The below code works for draging and droping one at a time, but not for multiselected...
1
by: John Dalberg | last post by:
I would like to select items from a listbox into another listbox using drag and drop functionality. Does ASP.NET 2.0 webparts support this? Or any open source free framework? I am not looking for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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,...
0
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...
0
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,...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
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...

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.