As the title tell, i want to delete a row from a data grid view and also it updates in the sql table.

I have this code so far :

DialogResult dr;

            dr = MessageBox.Show("Are you sure ?" , "Rent Returned", MessageBoxButtons.YesNoCancel);

            if (dr == DialogResult.Yes)
            {
                if (this.dgvRent.SelectedRows.Count > 0)
                {
                    dgvRent.Rows.RemoveAt(this.dgvRent.SelectedRows[0].Index);
                }
            }
            else
            {
                MessageBox.Show("Cancelled");
            }

thanks

Hi,
The main question is, are data in DGV bound to some collection (datatable for instance)?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.