There is such a database. I add several fields to the DGV, and then I need an event (Import in XML) in the handler to import all the data that was in the DGV into an XML file. I inserted the serialization code into the Add button, but then only one record could be saved in the XML that I added the first. And I need to first add a few to the grid, and then everything is in XML.
////кнопка add private void button1_Click(object sender, EventArgs e) { Form2 friendForm = new Form2(); DialogResult result = friendForm.ShowDialog(this); if (result == DialogResult.Cancel) return; friends friends = new friends(); friends.FirstName = friendForm.textBox1.Text; friends.LastName = friendForm.textBox2.Text; friends.Age = (int)friendForm.numericUpDown1.Value; friends.Number = friendForm.textBox3.Text; friends.House = (int)friendForm.numericUpDown2.Value; friends.Adress = friendForm.textBox4.Text; db.friendsSet.Add(friends); db.SaveChanges(); XmlSerializer serial = new XmlSerializer(typeof(friends)); using (FileStream fs = new FileStream(Environment.CurrentDirectory + "\\book.xml", FileMode.Create, FileAccess.Write)) { serial.Serialize(fs, friends); MessageBox.Show("XML was created"); } } 