0

So I have this piece of code:

e.Control.AllowDrop = true;
e.Control.Click += new EventHandler(btnClick);
e.Control.DragEnter += new DragEventHandler(btn_dropEnter);
e.Control.DragDrop += new DragEventHandler(btn_DragDrop);

the DragDrop event is only triggered when Im running it in debug with Visual Studio. When I run the same exe file it won't trigger. (Testing with attaching the process in Visual studio and placing break points)

Any ideas?

This used to work a while ago I don't remember changing it at all :(

Thanks

AshChlor
  • 143
  • 1
  • 13
  • 2
    User Account Control maybe? Try running your exe as admin. – Ray Nov 23 '14 at 21:16
  • 1
    If your EXE is running as admin you will not be able to drop anything from the desktop for example as the desktop is not running as admin. Only an admin application can drag something to another admin application. So try to run the EXE as non-admin. – Wolf5 Nov 23 '14 at 22:08
  • Thanks for the reply guys! Unfortunately I did try that it didn't work – AshChlor Nov 24 '14 at 04:35
  • By the way the DropEnter is triggered.. just not the dragDrop event – AshChlor Nov 24 '14 at 04:46
  • If DragEnter works but not DragDrop, are you absolutely sure it is dropped on the right control? DragEnter will happen if the mouse goes past that control, but drop will only fire if you are actually on the same control. Run a timer that displays the current control below the mouse. See http://stackoverflow.com/questions/586479/is-there-a-quick-way-to-get-the-control-thats-under-the-mouse. – Wolf5 Nov 24 '14 at 11:44
  • I tried that.. seems to be fine.. I also tried adding a loop that goes through all controls in the form and adds a dragdrop event with a messagebox that pops with the control name.. it pops for every control except the one I need! :( GAH! – AshChlor Nov 25 '14 at 06:33
  • also I remind you that when I run the code from Visual Studio in debug it works perfectly.. when I run the built exe outside visual studio thats where the problem occurs – AshChlor Nov 25 '14 at 06:37

0 Answers0