问题
foreach (DataGridViewRow item in this.dataGridView1.SelectedRows)
{
if (Int32.Parse(item.Cells[1].Value.ToString()) >= Int32.Parse(textBox4.Text) )
{
dataGridView1.Rows.RemoveAt(item.Index);
}
}
I'm trying to check if the integer in the second column is at least the value in textBox4. However, nothing is removed when I run this, so I feel it's not comparing the right column.
Do C# columns count from 0 or from 1?
回答1:
What index does dataGridView start at?
It starts at 0.
回答2:
dataGridView's both rows and Columns start at 0 index
来源:https://stackoverflow.com/questions/38526292/what-index-does-datagridview-start-at