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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:50:21+00:00 2026-06-03T05:50:21+00:00

My C# winform has a datagridview and when I clicked update button, what code

  • 0

My C# winform has a datagridview and when I clicked update button, what code should I put to check whether any cells had been edited?

I just need to have a true or false.

Thanks.

===========================================================================

My existing codes:

#region Edit Records
        private void InProSysAdministrationEventsUpdateButton_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Please Click Ok to Edit the Events", "Confirmation", MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                ManipulateData.UpdateData(connectionString, tblconn, tblscmd, tbldataadaptor, tbldatatable, cmbuilder, "usp_readallevents", readalleventsdataGridView);
            }
        }
#endregion

I need to do the following:

1) user click on edit

2) system check whether any cell had been edited

3) if no cell edited, it will messagebox.show(“No Changes Done.”)

4) else, it will update the database.

  • 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-06-03T05:50:22+00:00Added an answer on June 3, 2026 at 5:50 am

    Have you taken a look at the DataGridView.CellValueChanged Event? MSDN

    Would be fairly simple to just write a handler for this and set a flag, or perform whatever action you want.

    An example of how you might go about performing this would be:

        protected override void OnLoad(EventArgs e)
        {
            myDataGridView.CellValueChanged += new DataGridViewCellEventHandler(
            myDataGridView_CellValueChanged);
        }
    
        private void myDataGridView_CellValueChanged(
        object sender, DataGridViewCellEventArgs e)
        {
           //some very crude examples of actions you might want to perform when the event handler is triggered.
           myObject.update();
           //or something else like
           myObject.isUpdatable = true;
        }
    

    With regards to point number 3, a msgbox is probably not the best way to inform a user of a non-critical event. It is likely that they are already going to know that they haven’t entered any information, and you can provide this feedback less anoyying ways by perhaps flagging required cell, or whatever. Food for thought.

    In the future, I’d recommend searching MSDN for the class you are working with, and searching for the type of event, method, or property you are looking for, and see if anything matches. There are plenty of useful examples available as well.

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

Sidebar

Related Questions

alt text http://img517.imageshack.us/img517/8124/56267347.jpg Assuming i have a winform that has a button called Create
I have a Winform DataGridView , which has a number of predefined columns. Now
I have a WinForm that has a DataGridView table. It is bound to a
I've got a simple WinForm app which has a DataGridView on it. When the
My winform has a progress bar which should increase based on the number of
I have a Winforms app that has a DataGridView that is databound at runtime.
I have a DataGridView in a Winforms app that has about 1000 rows (unbound)
I have a winform app that has tabcontrols that are 3 layers deep. I
I have a winform form which has typical OK and Cancel buttons. The OK
Does anyone know how I can resize a winform when it has no border.

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.