Jayesh Acharya
asked on
delete a row in a datagrid
I am trying to delete a specific row in my datagrid, I am able to highlight a row and I can delete a row but the row I delete is always the bottom row of the grid.
I dont know how to pass the information of the row / rows I highlighted to delete
heres is the code i use to delete
private void deleteRow_Click(object sender, EventArgs ee)
{
StockCheckDataTable.Rows[d ataGridVie w1.Selecte dRows[0].I ndex].Dele te(); }
dont know how to pass the correct id for the row i highlighted ...
I dont know how to pass the information of the row / rows I highlighted to delete
heres is the code i use to delete
private void deleteRow_Click(object sender, EventArgs ee)
{
StockCheckDataTable.Rows[d
dont know how to pass the correct id for the row i highlighted ...
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
If i highlight multiple rows, is their a way to delete all the rows i highlighted, currently i just delete the last row of all the rows i highlight
Then you need to loop through the "SelectedRows" and delete them one by one.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Fantastic help easy to understand solutions thnask a lot
ASKER
int yCoord = dataGridView1.CurrentCellA
StockCheckDataTable.Rows[y