时它可以显示在的DataGridView
的行标题行号?
Is it possible to show row number in the row header of a DataGridView
?
我想这个code,但它不工作:
I'm trying with this code, but it doesn't work:
private void setRowNumber(DataGridView dgv)
{
foreach (DataGridViewRow row in dgv.Rows)
{
row.HeaderCell.Value = row.Index + 1;
}
}
我是否需要设置一些的DataGridView
属性?
看来,它并没有把它变成一个字符串。 尝试
It seems that it doesn't turn it into a string. Try
row.HeaderCell.Value = String.Format("{0}", row.Index + 1);
上一篇:两个字符串数组交集(忽略大小写)数组、大小写、字符串、两个
下一篇:为什么Path.Combine的驱动器盘符后不加Path.DirectorySeparatorChar?驱动器、不加、Combine、Path