Solved

Drag form a treeview node but do not allow drop VB.NET visual studio 2013

Posted on 2016-08-16
4
32 Views
Last Modified: 2016-08-16
I've been reading about drag and drop for the treeview control and all the examples I see deal with dragging and dropping, I just want to be able to drag nodes that are PDFs.

Is it possible to allow the end user to drag from the treeview control to an email or the desktop but not allow the end user to drop into the treeview control?

Thank you in advance.
0
Comment
Question by:printmedia
  • 2
  • 2
4 Comments
 
LVL 25

Accepted Solution

by:
SStory earned 500 total points
Comment Utility
Treeview control must have AllowDrop property set to true to be dropped in.
Also, I think the question of how to drag to desktop is probably answered here:
https://www.experts-exchange.com/questions/24718269/Drag-and-drop-to-desktop-or-control.html

If you want to limit the nodes that are dragged you will need to follow the examples MouseMove event code and check for PDF...whatever that means in your tree...if just text name whatever.pdf, then test the text of that node for .endswith(".pdf"), if some sort of object, then handle that accordingly.
0
 

Author Comment

by:printmedia
Comment Utility
Thank you for your reply. I don't want to allow the user to drop anything into the treeview control, I have some nodes that are documents (PDF, doc etc.), I want to allow the end user to drag from the treeview control and drop on the desktop or email but not the other way around (i.e. not allow the end user to drop documents into the treeview just be able to drag out of the treeview).
0
 
LVL 25

Expert Comment

by:SStory
Comment Utility
I know. That is why you set .AllowDrop=false on the treeview. That will prevent anyone from dropping on it. I think it is false by default.
Then you have to handle the possibility of dragging from the treeview control as an event on the treeview control. The link I provided shows you a way to do that and claims to allow dropping on the desktop.

I guess from my comment, "Treeview control must have AllowDrop property set to true to be dropped in." You didn't infer that you set it to false to prevent that.  Go back and read my entire post and check out the link to see if it doesn't help.
0
 

Author Comment

by:printmedia
Comment Utility
Ah yes. Sorry about that SStory. The first part of your reply threw me off. I'll play with it and post another question if I run into any issues. Thank you!
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now