473,785 Members | 2,261 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(obj ect sender,
System.Windows. Forms.DragEvent Args e)

{
if (e.Data.GetData Present(DataFor mats.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 2501
Take a look at this article:

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

Crouchie1998
BA (HONS) MCP MCSE
Nov 21 '05 #2
"Crouchie19 98" <cr**********@s pamcop.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.microso ft.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
1924
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 means an item in position 1 is now is position 3 and item 2 is now in postion 1 and item 3 is in position 2 and position 4 and 5 stay the same. I have searched the web.
2
4337
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 there? What about Drag/Drop; is there more than one way for the source to make data available Is it always OLE?
3
3521
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 allways get Nothing back. I've posted my code below - I hope someone here has a solution to this. Cheers Thomas Private Sub Label1_DragDrop(ByVal sender As Object, ByVal e As
0
1284
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 would be much appreciated. Bernie Private Sub frombox3_MouseDown(ByVal sender As Object, ByVal e As
5
10166
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 dropped onto it.. does anyone have any examples of this? thanks
3
10599
by: VB Programmer | last post by:
In VB.NET 2005 (winform) any sample code to drag & drop items between 2 listboxes? Thanks!
2
1322
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 field to hold source control name. 2. When mouse down, store name in this control. 3. Drag. 4. When drop, do postback from target control.
3
5869
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 MacDonald. You'd think it would be there. Anyone know?
2
2545
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 another listview. In code behind it should update the database.
0
9646
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
10350
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
10157
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...
0
9957
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8983
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
7505
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
6742
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
5386
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
3658
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.