By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,985 Members | 1,863 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,985 IT Pros & Developers. It's quick & easy.

Drag Drop Question

P: 59
I have a situation where in a winform application I have a tree view from which I need to drag drop tree nodes into a textBox contained in another application window.
I used the following code to handle the drag dragEnter and the dragDrop event of the textBox:

Expand|Select|Wrap|Line Numbers
  1. private void txtTrue_DragDrop(object sender, DragEventArgs e)
  2.         {
  3.             if (e.Data.GetDataPresent(typeof(TreeNode)))
  4.             {
  5.                 //Create a New Node based on the data contained in the drag node
  6.                 TreeNode tnNew = (TreeNode)e.Data.GetData(typeof(TreeNode));
  7.                 MessageBox.Show(tnNew.Name.ToString()); ;
  8.                 if (tnNew.ImageIndex == 2 || tnNew.ImageIndex == 2)
  9.                 {
  10.                     TextBox tb = (TextBox)sender;
  11.                     tb.Text = tnNew.Name.ToString();
  12.                 }
  13.             }
  14.         }
  16.         private void txtTrue_DragEnter(object sender, DragEventArgs e)
  17.         {
  18.             e.Effect = DragDropEffects.Copy;
  19.         }
The dragEnter event is acknowledging that the data dropped is a TreeNode however it is not able to access it. On debugging, by putting breakpoints at various places I discovered it has something to do with remoting. May be one application's data can be accessd by another application using remoting only.
I hardly know anything about remoting. Can someone please shed some light on how to achieve the desired result.
Thanks for reading my problem.

Feb 9 '09 #1
Share this question for a faster answer!
Share on Google+

Post your reply

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