簡體   English   中英

如何讀取下一個DataGridView行?

[英]How can I read the next DataGridView row?

如何使它讀取DataGridView和SetAttribute? 我一直在這樣做:

(string)dataGridView1.Rows[dataGridView1.SelectedRows[0].Index].Cells[0].Value)

讀取第一行,但我需要讀取0,然后讀取下一行(第一秒之后為1,依此類推)

我看了這個問題: DataGridView導航到下一行

但是我不知道怎么寫。

這是我現在閱讀的代碼:

webBrowser1.Document.GetElementById("pass").SetAttribute("value", (string)dataGridView1.Rows[dataGridView1.SelectedRows[0].Index].Cells[0].Value);

使用for循環逐一遍歷所有行

for(int i=0;i<datagrid.Rows.Count;i++){
    val=datagrid[0,i].Value.Tostring();   // 0 is column no
}

或通過手動增加行計數一會兒。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM