[英]Index of the current row in DataGridView
I have 2 DataGridViews and I transfer data between them. 我有2个DataGridViews,并在它们之间传输数据。 My question is: How can i move the index of datagridview1 row to next one after the data has been transfered. 我的问题是:传输数据后,如何将datagridview1行的索引移至下一行。
Code: 码:
int index = 0;
int index1 = 0;
for (int i = 0; i < produseDataGridView.CurrentCell.RowIndex; i++)
index = produseDataGridView.Rows[i].Cells["dprodus"].RowIndex;
for (int j = 0; j < produse_magazinDataGridView.CurrentRow.Index; j++)
index1 = produse_magazinDataGridView.Rows[j].Cells["produs"].RowIndex;
produseDataGridView.CurrentCell = produseDataGridView.Rows[index + 1].Cells[0];
produse_magazinDataGridView.CurrentCell = produse_magazinDataGridView.Rows[index1 + 1].Cells[0];
I'm not sure what you mean by "how can i move the index of datagridview1 row to next". 我不确定“如何将datagridview1行的索引移到下一个”的意思。
Index is just a integer in your code. 索引只是代码中的整数。 If you meant to write "how to select the next row" then its: 如果要编写“如何选择下一行”,则其内容为:
produseDataGridView.Rows(Index + 1).Selected = True;
produse_magazinDataGridView.Rows(Index1 + 1).Selected = True;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.