1
如何從此數組檢索記錄到我的列表視圖?使用數組保存和檢索記錄vb.net
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
Dim countitems As Integer
countitems = ListView2.Items.Count - 1
ReDim valueArray(countitems, 5)
Dim xarray = 0
For i As Integer = 0 To countitems
For Each Item As ListViewItem In ListView2.Items
valueArray(xarray, 0) = Item.Text
valueArray(xarray, 1) = Item.SubItems(1).Text
valueArray(xarray, 2) = Item.SubItems(2).Text
valueArray(xarray, 3) = Item.SubItems(3).Text
valueArray(xarray, 4) = Item.SubItems(4).Text
valueArray(xarray, 5) = Item.SubItems(5).Text
i += 1
Next
Next
End Sub
我不知道你在問什麼......在你的示例中,「我」和「xarray」是無用的變量。我假設你想刪除For I並增加xarray。 –
我有一個ListView控件在詳細模式下設置,並且在按鈕按下時,我想從ListView中的該行中檢索所有列值。 –