Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6821897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:35:56+00:00 2026-05-26T21:35:56+00:00

I have a winforms app that uses a UserControl. The user control’s job is

  • 0

I have a winforms app that uses a UserControl. The user control’s job is to collect a file that the user drops on it from Windows Explorer, Open the file, determine the type and handle it accordingly.

This control worked PERFECTLY under Visual Studio 2008 Pro. I upgraded to VS 2010 Pro, and now, it doesn’t work. Is there a flag or a property that has changed that I should be aware of??

I made a quick demo to test. This demo works perfectly under 2008, but doesn’t work at all under 2010.

The setup: Create a new winform project. Add a user control. Set the following code in the user control’s code section. (compile to get the user control to appear in the toolbox) Add the user control to the form. Run the program, and drag ANY file from windows onto the form. If it works, the user control area should change colors.

public partial class UserControl1 : UserControl
{
    public UserControl1()
    {
        InitializeComponent();

        this.AllowDrop = true;
        this.DragDrop += new DragEventHandler(UserControl1_DragDrop);
        this.DragEnter += new DragEventHandler(UserControl1_DragEnter);
        this.DragLeave += new EventHandler(UserControl1_DragLeave);
    }

    void UserControl1_DragLeave(object sender, EventArgs e)
    {
        this.BackColor = Color.FromName("Control");
    }

    void UserControl1_DragEnter(object sender, DragEventArgs e)
    {
        if (e.Data.GetDataPresent(DataFormats.FileDrop))
        {
            e.Effect = DragDropEffects.Copy;
            this.BackColor = Color.Blue;
        }
        else
        {
            e.Effect = DragDropEffects.None;
        }
    }

    void UserControl1_DragDrop(object sender, DragEventArgs e)
    {
        this.BackColor = Color.Yellow;
    }
}

I’m open to any explanation or fix that you guys may think up!

UPDATE:

I tested using the comments listed below. STILL doesn’t work. However, I have noted that it only fails while in the development environment. When I go to the bin directory and launch the program manually, it works fine. It just doesn’t work when I am in the development environment, which makes debugging a bit difficult. Still looking for the big-picture fix.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T21:35:57+00:00Added an answer on May 26, 2026 at 9:35 pm

    A likely failure cause here is UIPI, the user interface component of UAC. You cannot drag from a non-elevated process and drop to a window owned by an elevated process. You’ll trigger this when you started Visual Studio from a shortcut that has the “Run this program as an administrator” option in the Compatibility tab turned on. The only workaround is to turn that option off. Or to run it directly from the .exe file, as you discovered.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a winforms app that checks user credentials as it starts. If autharization
So we have a winforms app that in the task manager should anywhere from
I have a DataGridView control in a winforms app that I'm working on. The
I have a winforms app that uses a strongly typed custom DataSet for holding
I am working on a WinForms app that uses the ReportViewer control to show
I have a WinForms app that uses the Settings feature of .NET 2, but
I have a .NET 4 WinForms app that uses the ADO.NET Entity Framework. Some
We have a huge client/server WinForms app that uses .NET remoting to pass DAOs
I have a Winform App that uses a 3rd Party Library of Controls, DevExpress.
I have a CRUD winform App that uses Merge Replication to allow disconnected functionality.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.