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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:18:57+00:00 2026-06-07T22:18:57+00:00

My datagridview itemDelete function: this.dgv_items.RowsRemoved += this.dgv_items_itemDelete; private void dgv_items_itemDelete(object sender, DataGridViewRowsRemovedEventArgs e) {

  • 0

My datagridview itemDelete function:

this.dgv_items.RowsRemoved += this.dgv_items_itemDelete;

private void dgv_items_itemDelete(object sender, DataGridViewRowsRemovedEventArgs e)
{
    try
    {
        int row = e.RowIndex;
        string name = dgv_items.Rows[row].Cells[0].Value.ToString();
        deleteFromDB(name);
    }
    catch (Exception) { }
}

But by the time we reach this code, the row will have been removed, meaning dgv_items.Rows[row].Cells[0].Value gets the value if the row next in line.

I want to get the Cells[0] value of the removed row, so I can remove the item from the database file as well. How can I achieve this?

  • 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-07T22:18:59+00:00Added an answer on June 7, 2026 at 10:18 pm

    You could handle the UserDeletingRow event instead. Note that it supports event cancelation.

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

Sidebar

Related Questions

I have a DataGridView in a windows form. I defined 5 columns for this
I have a virtual datagridview that I want to set varying row heights for.
I have a datagridview which I'm using for data entry. I've done this before
I have a datagridview bound to a datasource, and in each row in the
DataGridView, for example, lets you do this: DataGridView dgv = ...; DataGridViewCell cell =
The DataGridView control allows you to click the row headers and select the rows
I set for my DataGridView object AllowUserToOrderColumns = true; How can I detect columns
I have a DataGridView with an edit option. I did my code, but this
In DataGridView I have CellValueChanged event, when user modify any cell value, this event
I have an editable DataGridView with SelectionMode set to FullRowSelect (so the whole row

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.