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 5970229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:20:41+00:00 2026-05-22T20:20:41+00:00

Whenever a user clicks the row header, which selects the whole row (and highlights

  • 0

Whenever a user clicks the row header, which selects the whole row (and highlights it blue), the cell in the first column is actually entered. That is, if you start typing stuff, the text goes in that cell. I want to prevent this. Would it be possible to have no datagridview cells being entered when one or many rows are selected?

I also need the solution to prevent cells being entered during multiple row selections caused by clicking and dragging on the row headers.

Any ideas on how I could achieve this?

Thanks

Isaac

  • 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-22T20:20:42+00:00Added an answer on May 22, 2026 at 8:20 pm

    Set your DataGridView’s ReadOnly property to true or false, depending on whether one or more rows have been selected or if the DGV’s ‘CellState’ has changed.

    Add the following two events for your DataGridView:

    private void dataGridView1_RowStateChanged(object sender, DataGridViewRowStateChangedEventArgs e) {
        if (e.StateChanged == DataGridViewElementStates.Selected) {
            Console.WriteLine("TRUE");
            dataGridView1.ReadOnly = true;
        }
    }
    
    private void dataGridView1_CellStateChanged(object sender, DataGridViewCellStateChangedEventArgs e) {
        if (e.StateChanged == DataGridViewElementStates.Selected) {
            Console.WriteLine("false");
            dataGridView1.ReadOnly = false;
        }
    }
    

    This worked for me in my tests but I wouldn’t be surprised if there were hidden ‘gotchas.’

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

Sidebar

Related Questions

My question is very simple: I have a column named DateProcessed. Whenever User Clicks
I have a dataGridView that has a column with checkboxes. Whenever the user clicks
I've a HTML div and I want to hide it whenever the user clicks
I have a textbox in which anytime user clicks on it a function in
Is there any event that can be called whenever the user clicks outside the
I building a page that will depend entirely on JavaScript. Whenever a user clicks
How do I postback whenever a user types in a textbox to filter results
So I want to trigger an event (pausing/unpausing some media) whenever the user presses
It seems to me that whenever a GUI (Graphical User Interface) is involved, the
For my first Silverlight app, I've written a program that sends user-supplied search strings

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.