private void SaveAsMenuItem_Click(object sender, EventArgs e) { if (this.DataSource == null) { return; } SaveFileDialog sf = new SaveFileDialog(); sf.InitialDirectory = this.LastDirectory; sf.DefaultExt = ".csv"; sf.Filter = "CSV files (*.csv)|*.csv|All files (*.*)|*.*"; sf.ShowDialog(); if (sf.FileName == "") { return; } this.LastDirectory = Path.GetDirectoryName(sf.FileName); IODataTable iodt = new IODataTable(); iodt.SaveDataTabletoCSV(sf.FileName, (DataTable)this.DataSource); }
private void SaveLocally() { if (this.DataSource == null) { return; } int changes = editedCells.Count; DialogResult mb = MessageBox.Show("Changes to " + changes.ToString() + " cell(s) have been registered for this data file. " + Environment.NewLine + "Would you like to save changes to: " + Environment.NewLine + this.FileName, "Save changes?", MessageBoxButtons.YesNoCancel); if (mb != DialogResult.Yes) { return; } IODataTable iodt = new IODataTable(); iodt.SaveDataTabletoCSV(this.FileName, (DataTable)this.DataSource); }