var count = this.dataGridViewArticles.Rows.Cast<DataGridViewRow>().Count(); var countjustX = this.dataGridView1.Rows.Cast<DataGridViewRow>() .Count(row => row.Cells["RisFin"].Value == "X"); this.textBox1.Text = count.ToString();