[英]How can I read the next DataGridView row?
How can I make this read the DataGridView and SetAttribute? 如何使它读取DataGridView和SetAttribute? I have been doing this:
我一直在这样做:
(string)dataGridView1.Rows[dataGridView1.SelectedRows[0].Index].Cells[0].Value)
to read the first row, but I need to read 0, and then the next row (1, after first second etc) 读取第一行,但我需要读取0,然后读取下一行(第一秒之后为1,依此类推)
I have looked at this question: DataGridView navigating to next row 我看了这个问题: DataGridView导航到下一行
But I don't know how to write it. 但是我不知道怎么写。
This is my code to read now: 这是我现在阅读的代码:
webBrowser1.Document.GetElementById("pass").SetAttribute("value", (string)dataGridView1.Rows[dataGridView1.SelectedRows[0].Index].Cells[0].Value);
use a for loop to go through all the rows one by one 使用for循环逐一遍历所有行
for(int i=0;i<datagrid.Rows.Count;i++){
val=datagrid[0,i].Value.Tostring(); // 0 is column no
}
or a while by manually incrementing row count.. 或通过手动增加行计数一会儿。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.