private object SummColumn(int index, SummType param) { if (param == SummType.Count) { int count = 0; foreach (DataGridViewRow row in dgv.Rows) { if (row.Visible) { count++; } } return count; } if (param == SummType.Value) { int summ = 0; foreach (DataGridViewRow row in dgv.Rows) { if (row.Visible) { if (row.Cells[index].Value.ToString() != ""){ summ += Convert.ToInt32(row.Cells[index].Value.ToString()); } } } return summ; } return null; }
private object SummColumn(DataGridViewColumn column, SummType param) { return SummColumn(column.Index, param); }
private object SummColumn(string ColumnName, SummType param) { return SummColumn(dgv.Columns[ColumnName], param); }