TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Scott
NA
2
0
Drag and drop between listboxes and treeview, and within treeview help
Sep 21 2009 10:52 AM
Hey everybody, I was hoping to get a little bit of information. I've implemented drag and drop between the listboxes and treeview, but I'm having a tough time getting it done within the treeview itself. It will show the effect of moving, but it will not delete itself from the previous node, and implement itself in the new node.
I know it's something incredibly easy, but my brain is tired!
Here's the DragDrop code:
private void tree_procAssign_DragDrop(object sender, DragEventArgs e)
{
TreeView tree = (TreeView)sender;
Point pt = new Point(e.X, e.Y);
pt = tree.PointToClient(pt);
TreeNode nodeTodropIn = this.tree_procAssign.GetNodeAt(pt);
TreeNode nodeSource = (TreeNode)e.Data.GetData(typeof(TreeNode));
if (nodeTodropIn == null) { return; }
object data = e.Data.GetData(typeof(string));
if (data == null) { return; }
TreeNode tempNode = new TreeNode(data.ToString());
if (lbx_processorAssign.Items.Contains(data.ToString()))
{
if (nodeTodropIn.Level == 0)
{
nodeTodropIn.Nodes.Add(tempNode);
nodeTodropIn.Expand();
if (nodeTodropIn.Nodes.Contains(tempNode))
lbx_processorAssign.Items.Remove(data.ToString());
}
}
if (lbx_alphaAssign.Items.Contains(data.ToString()))
{
if (nodeTodropIn.Level == 1)
{
nodeTodropIn.Nodes.Add(tempNode);
nodeTodropIn.Expand();
if (nodeTodropIn.Nodes.Contains(tempNode))
lbx_alphaAssign.Items.Remove(data.ToString());
}
}
if (tree_procAssign.Nodes.Contains((TreeNode)e.Data.GetData(typeof(TreeNode))))
{
nodeTodropIn.Nodes.Add((TreeNode)e.Data.GetData(typeof(TreeNode)));
nodeTodropIn.Expand();
}
}
Any thoughts, or is anyone able to push me in the right direction?
Thanks!
Scott
Reply
Answers (
2
)
I have a excel sheet, I need to color the Row - (plz dont send me the copy paste code & plz go through the requirment)
C# combobox multicolumn dropdown - select return one column value