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

Drag drop user controls between forms: getting originator's data

Hi
i have a sight problem with detecting the mouse up in a drag-drop outside a form
what i have on my hands is an mdi form with 2 child forms: form1 and form2, both containing a label each. i also have a separate class (global vars) contining static members to pass data between forms.:

MDI parent:
. form1
. form2
. globalvars

form1:
. label

form2:
. label

globalvars:
. passvalue

i want to drag form1.label to form2.label, and on doing so, the text should get copied

what i'm currently doing is this:
when i click on form1.label, i call its mousedown event, in which i set a globalvars.passvalue to the contents of form1.label
i also initiate DoDragDrop for the label., passing the label as the originator.

when i drop the control on to form2.label, it set;s form2.label.text to globalvars.passvalue

i'd like to know of a better way of doing this, maybe using the DragEventArgs for the DragDrop method for the target?

if not, then how do i catch the Mouseup, if it is anywhere but on form2.label, so as to clear globalvars.passvalue

thanks
Oct 26 '06 #1
1 2102
found the solution
i could pass the label's string as the data being passed,instead of the label itself

then get it and convert it back to a stringwith:

e.Data.GetData(DataFormats.Text).ToString()


im asuming thats the best way?
Oct 26 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

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: Ajay Krishnan Thampi | last post by:
I have a slight problem implementing 'drag and drop' from a datagrid to a tree-view. I have pasted my code below. Someone please advice me on what to do...pretty blur right now. ==code== ...
0
by: Norbert Heidbüchel | last post by:
Hi all, I have read a lot of postings and web pages about drag and drop and treeviews, but could not find an answer to my problem. Sorry, if I missed something. I am trying to drag and drop...
3
by: Goldwind | last post by:
Hi, I"m trying to use drag & drop of text from one text box to another but without suceess. Microsoft presented an example in "101 code samples" BUT in this example the code select and drag all...
0
by: James Allen Bressem | last post by:
Do drag n drop in VB.Net in ten lines of code - (too easy) I was searching through the MSDN documentation trying to figure out how to do drag n drop and I found a sample program. The sample...
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: JL | last post by:
I have found may examples for dragging and dropping between list boxes but I need to do it within one. Can some one point me to a tutorial or example. Prefer VB but can use C# too. TIA, John
0
by: DrBonzo | last post by:
I've inherited a body of C# code that has a 'Designer Host' (DH) based UI. Custom controls are selected from a 'toolbox' window and placed/sized in the DH interface. I'm trying to add a feature...
1
by: SteveDouglas | last post by:
Hi all, I am currently writing an application in VB.NET that has a lot of controls (treeviews/listviews/labels and so forth) that represent "things" that need to be draggable from place to place,...
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: 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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
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...

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.