i try this way but not working my code. please tell me where i made the mistake. give working code.
public partial class Form3 : Form { public Form3() { InitializeComponent(); } List<person> _person = null; private void Form3_Load(object sender, EventArgs e) { _person =new List<person>(); _person.Add(new person { ID = 1, Name = "Tridip" }); _person.Add(new person { ID = 2, Name = "Sujit" }); _person.Add(new person { ID = 3, Name = "Arijit" }); dgLogList.DataSource = _person; } private void button1_Click(object sender, EventArgs e) { foreach (DataGridViewRow dvr in dgLogList.SelectedRows) { if (dvr != null) { _person.RemoveAt(dvr.Index); dgLogList.DataSource = _person.ToList(); } } } } public class person { public int ID { get; set; } public string Name { get; set; } }