Solved

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

Posted on 2016-08-16
4
43 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
System32Int Error 8 56
DataGridview Currency Formating? 22 52
Convert to Hour/minute textbox and compare 3 52
DataGridView does not show data rows correctly in vb.net 2013 3 29
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
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…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

911 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

23 Experts available now in Live!

Get 1:1 Help Now