Solved

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

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

729 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