Goran Bibic

Goran Bibic

  • 480
  • 2.9k
  • 198.2k

Sum column to textbox where condition is word

Apr 26 2018 3:31 PM
Try this...result is 0
 
What I miss?
 
  1. ////gotovina  
  2.            double[] columnData2 = new double[mp_kasa_listaDataGridView.Rows.Count];  
  3.            columnData2 = (from DataGridViewRow row in mp_kasa_listaDataGridView.Rows  
  4.                           where row.Cells["dataGridViewTextBoxColumn16"].FormattedValue.ToString() != string.Empty && (row.Cells["dataGridViewTextBoxColumn14"].ToString()) == ("Gotovina").ToString()// && System.DateTime.ParseExact("d.M.yyyy", row.Cells["dataGridViewTextBoxColumn4"].ToString(), System.Globalization.CultureInfo.InvariantCulture) == System.DateTime.Now.Date  
  5.                           select Convert.ToDouble(row.Cells["dataGridViewTextBoxColumn16"].FormattedValue)).ToArray();  
  6.            textBox3.Text = columnData2.Sum().ToString("#,0.00");