C
C#2y ago
gbrlhz

❔ Drag and drop not working

It appears with a prohibited sign Here's my code: namespace WinFormsAppPrueba { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void listBox1_DragDrop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.All; else e.Effect = DragDropEffects.None; } private void listBox1_DragEnter(object sender, DragEventArgs e) { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); } } }
8 Replies
Anchy
Anchy2y ago
i think your logic is backwards you should set your curso/ effect onenter and you should get the data on drop i think you have to enable dropping as well
gbrlhz
gbrlhzOP2y ago
Oh yeah now it works @Anchy Even though that code is a mockup, for the real app i need admin privilage and there is failing
Anchy
Anchy2y ago
start the app as admin then if you want the app to request admin then look into application manifests namely requestedPrivileges and requestedExecutionLevel
gbrlhz
gbrlhzOP2y ago
yeah, i mean when i run the app as admin drag and drop is not allowed, @Anchy
Anchy
Anchy2y ago
Stack Overflow
Drag and drop event can not be fired when running visual studio in ...
I use Visual Studio 2008, .net framework 3.5 I have an webservice application (a winform client which is using webservice), and I have to run it in Administrator account I need to drag and drop f...
Anchy
Anchy2y ago
could be relevant here it's due to the UAC so I'm not sure how you can get around it
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server