Home > database >  How can i delete last row in Datagridview, XML database?
How can i delete last row in Datagridview, XML database?

Time:12-10

when i try to delete last row on Datagridview and XML database i cant delete. I can delete all of items normal but last row cant be deleted.

Here my delete button:

private void silbtn2_Click(object sender, EventArgs e)
    {
        XDocument x = XDocument.Load(@"../../Data/gemi1/gemi1s2.xml");
        x.Root.Elements().Where(a => a.Element("id").Value == siltxt2.Text).Remove();
        x.Save(@"../../Data/gemi1/gemi1s2.xml");
        yukle();
    }

CodePudding user response:

Set DataGridView.AllowUserToAddRows to false.

Set this property so that the last empty row is not displayed.

  • Related