private void Subtract_Clicked(object sender, EventArgs e) { BinDataGrid binDataGrid = SourceControl as BinDataGrid; float? value = FormCalculation.Show("Subtract", binDataGrid.DataProvider.UseFloats); if (value != null) { if (binDataGrid.DataProvider.UseFloats) { foreach (DataGridViewCell cell in binDataGrid.SelectedCells) { cell.Value = (float)cell.Value - value; } } else { foreach (DataGridViewCell cell in binDataGrid.SelectedCells) { cell.Value = (int)cell.Value - (int)value; } } } }
private void Divide_Clicked(object sender, EventArgs e) { BinDataGrid binDataGrid = SourceControl as BinDataGrid; float? value = FormCalculation.Show("Divide", binDataGrid.DataProvider.UseFloats); if (value.HasValue && value != 0) { if (binDataGrid.DataProvider.UseFloats) { foreach (DataGridViewCell cell in binDataGrid.SelectedCells) { cell.Value = (float)cell.Value / value; } } else { foreach (DataGridViewCell cell in binDataGrid.SelectedCells) { cell.Value = (int)cell.Value / (int)value; } } } }