using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Xml_DataSet
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private string nazwaPliku = "../../tabela.xml";

        private void button1_Click(object sender, EventArgs e)
        {
            dataSet1.ReadXml(nazwaPliku);
            dataGridView1.DataSource = dataSet1;
            dataGridView1.DataMember = "osoba";
        }

        private void button2_Click(object sender, EventArgs e)
        {
            System.IO.File.Copy(nazwaPliku, nazwaPliku+".bak", true);
            dataSet1.WriteXml(nazwaPliku);
        }

        private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            button2.Enabled = true;
        }
    }
}
