Click here to Skip to main content
15,884,237 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a Datagridview that contains columns. In the last column a add a button. and i want when i click on that button of a particular row then that row will be deleted. i tried in CellContentClick event but i can't find the method to remove it.
can any one help for it...
thanks.....
Posted

dataGridView1.Rows.Remove(dataGridView1.SelectedRows[0]);
should do it. Note that you might need the SelectionMode on the dataGridView to be FullRowSelect - I always have this set and I haven't got time just now to see if it works without that setting
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900