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

  • SEARCH
  • Home
  • 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 6694373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:05:39+00:00 2026-05-26T06:05:39+00:00

I have c# DataGridViews modified so that I can drag and drop rows between

  • 0

I have c# DataGridViews modified so that I can drag and drop rows between them. I need to figure out how to either disable dragging on certain rows, or reject the drop for these rows. The criteria I’m using is a value in the datarow.

I’d like to disable the row (gray it out and not allow drag) as my first choice.

What options do I have? How can I disable or reject drag-drop based on criteria?

  • 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-26T06:05:40+00:00Added an answer on May 26, 2026 at 6:05 am

    If you want to prevent a row from being dragged at all, use the following method instead:

    void dataGridView1_DragEnter(object sender, DragEventArgs e)
    {
        DataGridViewRow row = (DataGridViewRow)e.Data.GetData(typeof(DataGridViewRow)); // Get the row that is being dragged.
        if (row.Cells[0].Value.ToString() == "no_drag") // Check the value of the row.
            e.Effect = DragDropEffects.None; // Prevent the drag.
        else
            e.Effect = DragDropEffects.Move; // Allow the drag.
    }
    

    Here, I presume you start the drag operation by doing something like this:

    DoDragDrop(dataGridView1.SelectedRows[0], DragDropEffects.Move);
    

    In this case, you don’t need to use the method from my previous answer, of course.

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

Sidebar

Related Questions

I've been able to make 2 C# winform datagridviews drag and drop rows between
I have 2 DataGridViews and I transfer data between them. My question is: How
I have a Windows Form that displays several DataGridViews in the following layout: (No
I have a DataTable that has a boolean column called [Invalid]. I need to
I have a webpage in asp.net that I am trying to lay out and
I have two DataGridViews that have the same column schema (although two different DataViews
So I have several datagridviews that we had set to FullRowSelect . The users
I have two DataGridView controls, with three buttons in between them vertically, in a
I have 4 datagridviews. based on user's selection I'll bring on of them to
I have a windows form that has two DataGridViews (DGVs) that will hold 25,000+

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.