Solved

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

Posted on 2016-08-16
4
70 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 25

Accepted Solution

by:
SStory earned 500 total points
ID: 41758349
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
ID: 41758354
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
ID: 41758365
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
ID: 41758376
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

624 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