public MainForm() { InitializeComponent(); // Keep a reference to the editable root collection _pdvColllection = BusinessLogic.PDVCollection.GetList(); // Initialise the BindingSource with data. The DataGridView is connected to the BindingSource pdvCollectionBindingSource.DataSource = _pdvColllection; }
private void saveButton_Click(object sender, EventArgs e) { // Save the root collection - this will update all of the items in the collection. // - Note a new root collection is returned. if (!_pdvColllection.IsValid) { MessageBox.Show("Cannot save list because some items are invalid", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } _pdvColllection = _pdvColllection.Save(); // Update the binding source with the new instance; pdvCollectionBindingSource.DataSource = null; pdvCollectionBindingSource.DataSource = _pdvColllection; }