Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Looping an array to ListView

$
0
0
I have a file that I am trying to add to a list view that has multiple columns. I am having a problem getting it to add the correct items to the correct subitem's column. I think I almost have it but I'm sure I am missing some small thing.

The files looks as such.
1;2;3;4;5;6


Here is the function.
[ autoit ]      
Func _FillList()     $array = 1     $data = 1     Local $file = @ScriptDir & "\" & "mob.txt"     $data = FileRead($file)     $array = StringSplit($data, ";", 1)     For $n = 1 To UBound($array) - 1         If Mod($n, 2) Then             $subitem = _GUICtrlListView_AddItem($ListView, $array[$n])         Else             _GUICtrlListView_AddSubItem($ListView, $subitem, $array[$n], 1)             $a = UBound($array) - 1             If $n + 1 > $a Then                 ExitLoop             Else                 _GUICtrlListView_AddSubItem($ListView, $subitem, $array[$n + 1], 2)             EndIf         EndIf     Next EndFunc ;===>_FillList

Is there a simple way to just tell it to move to the next item in the loop? Currently the way it is displaying is
1 | 2 | 3
3 | 4 | 5
5 | 6


Viewing all articles
Browse latest Browse all 12506

Trending Articles