private void DoImport(object sender, EventArgs ea) { using (var dlg = new FormTextPad(false, headers, null)) { int n; do { dlg.ShowDialog(this); if (dlg.DialogResult == DialogResult.Cancel) { return; } n = db.ImportFlows(dlg.Content, csvSeparator); }while(n <= 0); Close(); // the displayed data are no longer up to date after importing } }
private void DoExport(object sender, EventArgs ea) { csv.Clear(); foreach (DataGridViewRow row in table.Rows) // iterate all .Rows to preserve display order; .SelectedRows may have a different order { if (!row.Selected) { continue; } foreach (var c in DataColumns) { csv.Append(row.Cells[c].Value).Append(csvSeparator); } BackDown(csv, csvSeparator) .AppendLine(); } using (var dlg = new FormTextPad(true, headers, csv.ToString())) dlg.ShowDialog(this); }