private void DataGridBarang_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { if ((bool)DataGridBarang.Rows[e.RowIndex].Cells[0].Value == false) { DataGridBarang.Rows[e.RowIndex].Cells[0].Value = true; } else { DataGridBarang.Rows[e.RowIndex].Cells[0].Value = false; } //Total Jumlah Barang from Checkbox TotalHarga.Text = (DataGridBarang.Rows.Cast<DataGridViewRow>() .Where(a => Convert.ToBoolean(a.Cells[0].Value.Equals(true))) .Sum(t => Convert.ToDouble(t.Cells[2].Value)).ToString()); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)