What index does dataGridView start at?

风流意气都作罢 提交于 2021-02-11 06:54:41

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!