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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:25:26+00:00 2026-05-27T17:25:26+00:00

I am displaying a data in DataGridView object. The first column represents a delete

  • 0

I am displaying a data in DataGridView object. The first column represents a delete and second is edit as check boxes, the rest is data.

What I am trying to do is to do delete and edit to the selected data when one of the check boxes are selected.

I am stuck of how to do something when one of check boxes was selected, basically how to check which field was clicked.

How do I do this?

I have this which uncheck any other field checked earlier:

public MainWindow()
{
    InitializeComponent();

    dgvPC.CellContentClick += new DataGridViewCellEventHandler(ContentClick_CellContentClick);
}

void ContentClick_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
    foreach (DataGridViewRow row in dgvPC.Rows)
    {
        row.Cells[Delete1.Name].Value = false;
        row.Cells[Edit1.Name].Value = false;
    }
}

I am adding data as such:

if (security.DecryptAES(read.GetString(1), storedAuth.Password, storedAuth.UserName) == "PC Password")
{
    // Count PC passwords.
    countPC++;

    dgvPC.Rows.Add(read.GetInt32(0), false, false, 
        security.DecryptAES(read.GetString(5), storedAuth.Password, storedAuth.UserName), 
        security.DecryptAES(read.GetString(6), storedAuth.Password, storedAuth.UserName));
}
  • 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-27T17:25:26+00:00Added an answer on May 27, 2026 at 5:25 pm

    I infer from your statement that you are unable to identify which checkbox is being considered

    So to narrow in you should attempt at using the CellValueChanged event of the grid

    void grd_CellValueChanged(object sender, DataGridViewCellEventArgs e)
    {
         if ((sender as DataGridView).CurrentCell is DataGridViewCheckBoxCell)
         {
              //Now you know its a checkbox
              //use the ColumnIndex of the CurrentCell and you would know which is the column
              // check the state by casting the value of the cell as boolean
         }
    }
    

    If you want the action to be immediate then you will have to commit the value and this happens when the focus moves out of the cell. Try handling CurrentCellDirtyStateChanged of the grid

    Something like this should work for you

    void grd_CurrentCellDirtyStateChanged(object sender, EventArgs e)
    {
        if (grd.IsCurrentCellDirty)
        {
            grd.CommitEdit(DataGridViewDataErrorContexts.Commit);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to disable a number of text boxes intended for displaying data
First, a little background: I'm displaying a data set with 288 rows and 8
I am displaying data in gridview,that has 12 column.When I displaying it ,it is
I am displaying data from SQL in a datagridview by using a SqlDataAdapter. (This
Hi i have data gridview button column its displaying button fine .... but it
I'm displaying data in a html table (datatables jquery plugin). One column displays the
I'm having difficulties displaying data in a UITextView in iPhone programming. I'm analyzing incoming
I would like to use databinding when displaying data in a TextBox. I'm basically
I'm having a problem displaying data from a function to text box within a
I have a WCF web-service and a Silverlight app displaying data from that service.

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.