467,161 Members | 982 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,161 developers. It's quick & easy.

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
  • viewed: 1916
Share:
1 Reply
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

Post your reply

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

Similar topics

2 posts views Thread by SamSpade | last post: by
3 posts views Thread by Ajay Krishnan Thampi | last post: by
3 posts views Thread by Goldwind | last post: by
5 posts views Thread by Brian Henry | last post: by
reply views Thread by DrBonzo | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.