private void SaveAllImportPathes() { // need to save back all the rows DBImportPath.ClearAll(); foreach (DataGridViewRow row in dataGridView_ImportPathes.Rows) { if (row.Index != dataGridView_ImportPathes.NewRowIndex) { DBImportPath importPath = new DBImportPath(); importPath[DBImportPath.cIndex] = row.Index.ToString(); foreach (DataGridViewCell cell in row.Cells) if (cell.ValueType.Name == "Boolean") importPath[cell.OwningColumn.Name] = (Boolean)cell.Value; else importPath[cell.OwningColumn.Name] = (String)cell.Value; importPath.Commit(); } } }
private void dataGridView_ImportPathes_CellValueChanged(object sender, DataGridViewCellEventArgs e) { DBImportPath importPath = new DBImportPath(); importPath[DBImportPath.cIndex] = e.RowIndex.ToString(); foreach (DataGridViewCell cell in dataGridView_ImportPathes.Rows[e.RowIndex].Cells) { if (cell.Value != null) { if (cell.ValueType == typeof(Boolean)) importPath[cell.OwningColumn.Name] = (Boolean)cell.Value; else importPath[cell.OwningColumn.Name] = (String)cell.Value; } } importPath.Commit(); }