Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2016-08-16
4
Medium Priority
?
87 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 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

722 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