473,385 Members | 1,838 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 and drop of items between listboxes

Sam
Hi,
I've done the method described here :
http://64.78.52.104/FAQ/WinForms/FAQ_c87c.asp#q565q

It works well for items added at design time. However if my source list
is filled with a datasource, the items are properly displayed but the
method
private void OnDragEnter(object sender,
System.Windows.Forms.DragEventArgs e)

{
if (e.Data.GetDataPresent(DataFormats.Text) && !isDropSource )

e.Effect = DragDropEffects.Copy;
else
e.Effect = DragDropEffects.None;
}
doesn't work anymore as GetDataPresent returns always False.

Someone can help ?

Thx

Nov 21 '05 #1
7 2479
Take a look at this article:

http://support.microsoft.com/kb/307966/EN-US/

Crouchie1998
BA (HONS) MCP MCSE
Nov 21 '05 #2
"Crouchie1998" <cr**********@spamcop.net> schrieb:
Take a look at this article:

http://support.microsoft.com/kb/307966/EN-US/


.... and the VB.NET version:

How To Provide File Drag-and-Drop Functionality in a Visual Basic .NET
Application
<URL:http://support.microsoft.com/?scid=kb;EN-US;306969>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3
Sam
But that's exactely what I'm doing as described in the link I gave
above.
The issue is that it doesn't seem to work with listbox which data has
been loaded via a datasource(in opposition to loading the data at
design time)

Nov 21 '05 #4
Sam,

I would be suprised if it was in another way.

You have told that the listbox uses as datasource. What is probably a
datatable (or a view to it) or a list with is filled with objects from a
special class. Let assume it is a datatable. Than you have told to the
listbox that it has to use from maybe 100 items in the datacolumn colection
a certain column.

You drag one item in it in it.
What should it than do?
Create a new datarow
Give that a primary key (little bit funny when it is not an
autoidentifier)
Set the displaymember to a value
Leave 99 columns blank.

Or had you something else in mind I think that there are endless
posibilities.

The items collection in a listbox is seperated from the datasource. In fact
are it two type controls in one. And you wrote it alreaydy drag and drop of
items.

Just my thought,

Cor
Nov 21 '05 #5
Sam
Cor,

hummm.. I don't understand your message, sorry.
My first list is filled with a datasource (actually it's a dataview, to
answer your question ;-)). Then I drag n drop an item to the second
list. To me once the first list has been filled in, the items inside
are just ... well, items ! So I don't see the difference whether the
list has been filled at design time (hard coded values) or via a
datasource, as the content is still text. Am I missing something ?

Nov 21 '05 #6
Sam,

No it are no items, it is a reference to a column in the dataview, what is
itself again a reference to a column in a datatable, who holds itself rows,
wherefrom the column describes the item. That object is the item.

http://msdn.microsoft.com/library/de...itemstopic.asp

Look what is written on this page about adding and removing when there is a
datasource.

Cor
Nov 21 '05 #7
Sam
Ok, I understande. How can I implement drag and drop between two lists
then in that case ? It seems a bit hard and pointless actually as I'm
doing the transfer via double click now and it works much better and
it's more user friendly)

Thx

Nov 21 '05 #8

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

Similar topics

3
by: simon_s_li | last post by:
Hi, I am having problems using drag drop and re-ordering items. Example: When I drag and item from position 1 and drag it to position 3, I want to re-order all the items accordingly. This...
2
by: SamSpade | last post by:
There seems to be two ways to put things on the clipboard ( I don't mean different formats): SetClipboardData and OleSetClipboard If I want to get data off the clipboard do I care how it was put...
3
by: Thomas | last post by:
Hi all, I've got a half-functioning drag-drop from outlook app running. I can get the name of the message from the FileGroupDescriptor part, but whenever I try to get the FileContents part, I...
0
by: Bernie Yaeger | last post by:
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...
5
by: Brian Henry | last post by:
I haven't worked much with drag/drop but I am trying to make a form that accepts files to drug onto it from explorer and droped and have the form know the full path and file name of the files...
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: CNemo | last post by:
Hello friends! I need to do subj and VS03. No Atlas or something like this. Would be great if somebody may share a small sample how to do it. What i have in mind is like: 1. Create hidden...
3
by: Rob | last post by:
I've searched for info on how to drag and drop a group of strings (or any other object) from one control to another. Looked through articles by Dino Esposito, checked the Forms books by Sells and...
2
by: ngajjar | last post by:
An application I am working with has two listview controls. Items are added runtime from the database when form load. It requires a mechanism which allow user to drag item from a listview and drop in...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
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
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...

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.