當前位置:成語大全網 - 新華字典 - VB.NET 遍歷 DataGridView

VB.NET 遍歷 DataGridView

遍歷的例子:

Dim i, j As Integer

For i = 0 To DataGridView1.RowCount - 1

  For j = 0 To DataGridView1.ColumnCount - 1

MsgBox(DataGridView1.Item(j, i).Value)

Next

Next

註意:與Excel的單元格命名規則不壹樣,這裏的 Item(j, i) 中,列號 j 在前,行號 i 在後。