this example allows you to drag an image file from outside your app onto a picturebox, and VB will handle it via drag/drop to display the image.
this is just a sample, but could easily be modified for using other file types. I couldn't find much on the web for doing this type of stuff... so I thought it might be useful to others.
Last edited by kleinma; Apr 26th, 2006 at 08:27 AM.
I've a problem with darg&drop using VB.NET 2003. I want to drop files from explorer, running under user x, to my application, running under user y.
With the code for "normal" drag&drop it doesn't works.
Any solutions?
Your question would really be better in the VB.NET forum here, as this is really just the codebank forum, where example code is posted. Not too many people are in this specific forum actually answering questions.
I don't have an answer for you, but I am sure it has to do with permissions. Do you get an error of any sort? Is User Y a higher level user than User X? Like your app is running under admin permissions, but the logged in user only has user permissions?
this example allows you to drag an image file from outside your app onto a picturebox, and VB will handle it via drag/drop to display the image.
this is just a sample, but could easily be modified for using other file types. I couldn't find much on the web for doing this type of stuff... so I thought it might be useful to others.
thanks for the example kleinma. when it comes to the picturebox, i am unable to set it to allowdrop = true in form load because it doesnt show as an option in 2005 express? but when i type it in anyway, it allows it. why is that?
thanks for the example kleinma. when it comes to the picturebox, i am unable to set it to allowdrop = true in form load because it doesnt show as an option in 2005 express? but when i type it in anyway, it allows it. why is that?
Great question. I had the same one myself and emailed Microsoft to find out.
I wrote
Microsoft:
With reference to the .NET picturebox control, why does the .AllowDrop property have to be set at runtime in code rather than being set at design time in the picturebox properties? All other controls that have this property allow you to set at design time. Is there a reason why the picturebox is different?
I got this response:
Thank you for contacting the .NET Framework team. We appreciate your comments. By taking the time to write, you are helping us to improve the quality of our documentation and samples.
The PictureBox control is not designed to allow drag and drop procedures. However, since PictureBox inherits from control, it also inherits the AllowDrop property. To clarify this, in the next release of the documentation, the PictureBox.AllowDrop topic will be marked with the “for internal use only” boilerplate. Also, the PictureBox.AllowDrop property will not appear in intellisense if you are using the Visual Studio text editor.
to which I replied:
Thank you for your response. Is there any specific reason why the picturebox is not "designed" to allow drag/drop procedures? Is there any negative impact to using a picture box for such tasks? For example, a picturebox you can drag image files from windows explorer over and have it display the image in the box on drop. It just seems odd to me why something with inherited functionality to be limited. I imagine the Microsoft developers have some reasoning behind this, correct?
sure doesnt make sense because thats what i thought a picture box was all about. to be able to handle pictures/images in many different ways. least you got a reply from your initial request. microsoft is kinda strange at the best of times anyway.
when I find errors in the documentation, or I find behavior in a class/control that doesn't mirror what the documentation says, I always email the doc team there at MS. I don't think there has been one time I haven't gotten an initial response back with an answer.
sir can u tell me agian ?on how to drag and drop from vb.net to explorer(desktop)or device?
like i'm has program for control music joint with access database so if i want drag to desktop can or not?
ples see picture
thanks u
Last edited by morokat; Jan 30th, 2010 at 09:19 AM.