【已解决】怎样将listview中的数据读取后直接存到二维数组中呢?
本帖最后由 meteor0330 于 2014-8-12 08:58 编辑有如下代码,我想将listview中的数据读取后直接存到二维数组中,能做到吗?
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 531, 395, 1092, 129)
$ListView1 = GUICtrlCreateListView("row|row1|row2|row3", 30, 20, 456, 326)
$ListView1_0 = GUICtrlCreateListViewItem("a|a1|a2|a3", $ListView1)
$ListView1_1 = GUICtrlCreateListViewItem("b|b1|b2|b3", $ListView1)
$ListView1_2 = GUICtrlCreateListViewItem("c|c1|c2|c3", $ListView1)
$ListView1_3 = GUICtrlCreateListViewItem("d|a1|d2|d3", $ListView1)
$ListView1_4 = GUICtrlCreateListViewItem("e|e1|e2|e3", $ListView1)
$Button1 = GUICtrlCreateButton("存入数组", 70, 355, 65, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
GetItem()
EndSwitch
WEnd
Func GetItem()
EndFunc ;==>GetItem
我这个GetItem应该怎么写呢? #include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#Include <GuiListView.au3>
#Include <array.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 531, 395, 1092, 129)
$ListView1 = GUICtrlCreateListView("row|row1|row2|row3", 30, 20, 456, 326)
$ListView1_0 = GUICtrlCreateListViewItem("a|a1|a2|a3", $ListView1)
$ListView1_1 = GUICtrlCreateListViewItem("b|b1|b2|b3", $ListView1)
$ListView1_2 = GUICtrlCreateListViewItem("c|c1|c2|c3", $ListView1)
$ListView1_3 = GUICtrlCreateListViewItem("d|a1|d2|d3", $ListView1)
$ListView1_4 = GUICtrlCreateListViewItem("e|e1|e2|e3", $ListView1)
$Button1 = GUICtrlCreateButton("存入数组", 70, 355, 65, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
GetItem()
EndSwitch
WEnd
Func GetItem()
Local $aArray
For $i = 0 To _GUICtrlListView_GetItemCount($ListView1)-1
Local $aItem = _GUICtrlListView_GetItemTextArray($ListView1,$i)
For $j = 1 To UBound($aItem)-1
$aArray[$i][$j-1] = $aItem[$j]
Next
Next
_ArrayDisplay($aArray)
EndFunc ;==>GetItem回复 1# meteor0330 回复 2# tubaba
太感谢了!
二维数组把我弄得有点晕了!! 更正一下,第32行应该加上StringSplit 学习一下。。。谢谢 数组搞得头疼,感谢,感谢。学习了。非常感谢
页:
[1]