_GUICtrlListView_SetItemText funktioniert nicht

  • Hallöchen ihr lieben,
    ich sitze gerade an einem Listview, eher gesagt an 2 Listviews.
    Im Linken Listview stehen Usernamen, im rechten einige Daten zu diesen Usern.
    Ich möchte nun das rechte Listview sortierbar machen mit

    [autoit]

    _GUICtrlListView_RegisterSortCallBack
    _GUICtrlListView_SortItems

    [/autoit]

    Soweit klappt es auch, nur ändern sich dadurch ja nicht die Einträge des ersten Listviews.
    Ich habe jetzt eine Möglichkeit gefunden (dachte ich ^^), das erste Listview ebenfalls umzustellen.
    Allerdings klappt dabei _GUICtrlListView_SetItemText nicht

    Hier ein Beispielscript

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <TabConstants.au3>
    #include <WindowsConstants.au3>
    #include <ListviewConstants.au3>
    #include <GuiListView.au3>
    #include <Date.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Global $Kampcode[15][3], $newarray[16][15], $AgentKamp[15], $iActiveAgent, $iActiveTab, $Sortarray[1][2]

    [/autoit] [autoit][/autoit] [autoit]

    $Datumsplitnow = StringSplit(_NowCalcDate(), "/")
    $iDay = $Datumsplitnow[3]
    $iMonth = $Datumsplitnow[2]
    $iYear = $Datumsplitnow[1]
    $Yearsplit = StringSplit($iYear, "")
    $DatumJJ = $Yearsplit[3] & $Yearsplit[4]

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 1 To 14
    For $k = 1 To 14
    $newarray[$i][$k] = Random(0, 9999, 1)
    Next
    Next
    _ArrayDisplay($newarray)
    $newarray[15][13] = "Suche1"
    $newarray[15][12] = "Suche2"
    $newarray[15][11] = "Suche3"
    $newarray[15][9] = "Suche4"
    $newarray[1][1] = "A"
    $newarray[2][1] = "B"
    $newarray[3][1] = "C"
    $newarray[4][1] = "D"
    $newarray[5][1] = "E"
    $newarray[6][1] = "F"
    $newarray[7][1] = "G"
    $newarray[8][1] = "H"
    $newarray[9][1] = "I"
    $newarray[10][1] = "J"
    $newarray[11][1] = "K"
    $newarray[12][1] = "L"
    $newarray[13][1] = "M"
    $newarray[14][1] = "N"
    _ArrayDisplay($newarray)
    $AgentKamp[1] = "|A|B|C|D|E|F|G|"
    $AgentKamp[2] = "|A|B|C|D|E|F|G|H|I|J|K|L|M"
    $AgentKamp[3] = "|A|B|C|D|E|F|G|"
    $AgentKamp[4] = "|A|B|C|D|E|F|G|"
    $AgentKamp[5] = "|A|B|C|D|E|F|G|"
    $AgentKamp[6] = "|A|B|C|D|E|F|G|H|I|J|K|L|M|N|"
    $AgentKamp[7] = "|A|B|C|D|E|F|G|"
    $AgentKamp[8] = "|A|B|C|D|E|F|G|"
    $AgentKamp[9] = "|A|B|C|D|E|F|G|"
    $AgentKamp[10] = "|A|B|C|D|E|F|G|H|I|J|K|L|M|N|"
    $AgentKamp[11] = "|A|B|C|D|E|F|G|"
    $AgentKamp[12] = "|A|B|C|D|E|F|G|H|I|J|K|L|M|N|"
    $AgentKamp[13] = "|A|B|C|D|E|F|G|"
    $AgentKamp[14] = "|A|B|C|D|E|F|G|"

    [/autoit] [autoit][/autoit] [autoit]

    $Kampcode[1][2] = '1_' & $iMonth & '_' & $DatumJJ
    $Kampcode[2][2] = '2_' & $iMonth & '_' & $DatumJJ
    $Kampcode[3][2] = '3_' & $iMonth & '_' & $DatumJJ
    $Kampcode[4][2] = '4_' & $iMonth & '_' & $DatumJJ
    $Kampcode[5][2] = '5_' & $iMonth & '_' & $DatumJJ
    $Kampcode[6][2] = '6_' & $iMonth & '_' & $DatumJJ
    $Kampcode[7][2] = '7_' & $iMonth & '_' & $DatumJJ
    $Kampcode[8][2] = '8_' & $iMonth & '_' & $DatumJJ
    $Kampcode[9][2] = '9_' & $iMonth & '_' & $DatumJJ
    $Kampcode[10][2] = '10_' & $iMonth & '_' & $DatumJJ
    $Kampcode[11][2] = '11_' & $iMonth & '_' & $DatumJJ
    $Kampcode[12][2] = '12_' & $iMonth & '_' & $DatumJJ
    $Kampcode[13][2] = '13_' & $iMonth & '_' & $DatumJJ
    $Kampcode[14][2] = '14_' & $iMonth & '_' & $DatumJJ

    [/autoit] [autoit][/autoit] [autoit]

    Dim $Tabs[UBound($Kampcode)]
    Dim $LV_Kontakt[UBound($Kampcode)]
    Dim $LV_Agent[UBound($Kampcode)]
    Dim $hLV_Kontakt[UBound($Kampcode)]
    Dim $hLV_Agent[UBound($Kampcode)]
    Dim $Kampkennzahl[UBound($Kampcode)]

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 0 To UBound($LV_Agent) - 1
    $LV_Agent[$i] = -9999
    $LV_Kontakt[$i] = -9999
    Next

    [/autoit] [autoit][/autoit] [autoit]

    $Viewgui = GUICreate("Tabbed Monitoring Dialog", 407, 438, 193, 85)
    $PageControl1 = GUICtrlCreateTab(8, 8, 396, 384, $WS_VSCROLL)
    GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
    $Zeile = UBound($newarray) - 1
    #region Suche
    $List1 = _Array2DSearch($newarray, "Suche1", -1, UBound($newarray) - 2, 0, 0, False, True)
    $s1 = StringSplit($List1[0], "|")

    [/autoit] [autoit][/autoit] [autoit]

    $List2 = _Array2DSearch($newarray, "Suche2", -1, UBound($newarray) - 2, 0, 0, False, True)
    $s2 = StringSplit($List2[0], "|")

    [/autoit] [autoit][/autoit] [autoit]

    $List3 = _Array2DSearch($newarray, "Suche3", -1, UBound($newarray) - 2, 0, 0, False, True)
    $s3 = StringSplit($List3[0], "|")

    [/autoit] [autoit][/autoit] [autoit]

    $List4 = _Array2DSearch($newarray, "Suche4", -1, UBound($newarray) - 2, 0, 0, True, False)
    #endregion Suche
    For $i = 1 To UBound($Kampcode) - 1
    $Tabs[$i] = GUICtrlCreateTabItem($Kampcode[$i][2])
    $data = StringSplit($AgentKamp[$i], "|")
    $LV_Agent[$i] = GUICtrlCreateListView("Agent ", 16, 160, 128, 224, -1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_TRACKSELECT))
    _GUICtrlListView_RegisterSortCallBack($LV_Agent[$i])
    $hLV_Agent[$i] = GUICtrlGetHandle($LV_Agent[$i])
    GUICtrlSetBkColor($LV_Agent[$i], 0xFFFFFF)
    GUICtrlSetBkColor($LV_Agent[$i], $GUI_BKCOLOR_LV_ALTERNATE)
    For $k = 2 To $data[0]
    GUICtrlCreateListViewItem($data[$k], $LV_Agent[$i])
    GUICtrlSetBkColor(-1, 0xFFDEAD)
    Next
    $LV_Kontakt[$i] = GUICtrlCreateListView("Spalte 1|Spalte 2|Spalte 3|Spalte 4|Spalte 5", 145, 160, 238, 224, -1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_TRACKSELECT))
    _GUICtrlListView_RegisterSortCallBack($LV_Kontakt[$i])
    $hLV_Kontakt[$i] = GUICtrlGetHandle($LV_Kontakt[$i])

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlSetBkColor($LV_Kontakt[$i], 0xFFFFFF)
    GUICtrlSetBkColor($LV_Kontakt[$i], $GUI_BKCOLOR_LV_ALTERNATE)
    For $k = 2 To $data[0]
    $Agent = _Array2DSearch($newarray, $data[$k], -1, 0, 0, 0, False, True)
    $a = StringSplit($Agent[0], "|")
    If $a[1] <> -1 Then

    [/autoit] [autoit][/autoit] [autoit]

    $VaraB = "0"
    For $e = 1 To UBound($List4) - 1
    $s4 = StringSplit($List4[$e], "|")
    $VaraB += $newarray[$a[1]][$s4[2]]
    Next
    $Quote = $VaraB / $newarray[$a[1]][$s1[2]] * 100
    $Quote = Round($Quote, 2)
    $List5 = $newarray[$a[1]][$s1[2]] / $newarray[$a[1]][$s2[2]] * 60
    $List5 = Round($List5, 2)

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateListViewItem($newarray[$a[1]][$s1[2]] & "|" & $List5 & "|" & $VaraB & "|" & $newarray[$a[1]][$s3[2]] & "|" & $Quote, $LV_Kontakt[$i])
    GUICtrlSetBkColor(-1, 0xFFDEAD)
    Else
    GUICtrlCreateListViewItem("0|0|0|0|0", $LV_Kontakt[$i])
    GUICtrlSetBkColor(-1, 0xFFDEAD)
    EndIf
    Next
    Next
    GUICtrlCreateTabItem("")

    [/autoit] [autoit][/autoit] [autoit]

    $Button1 = GUICtrlCreateButton("&OK", 94, 408, 75, 25, $WS_GROUP)
    $Button2 = GUICtrlCreateButton("&Cancel", 174, 408, 75, 25, $WS_GROUP)
    $Button3 = GUICtrlCreateButton("&Help", 256, 408, 75, 25, $WS_GROUP)
    GUISetState(@SW_SHOW)
    $iActiveTab = GUICtrlRead($PageControl1) + 1
    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    GUISetState(@SW_HIDE)
    GUIDelete($Viewgui)
    ExitLoop
    Case $PageControl1
    $iActiveTab = GUICtrlRead($PageControl1) + 1
    ConsoleWrite("Aktiver Tab " & $iActiveTab & @CRLF)
    Case $Button1
    GUISetState(@SW_HIDE)
    GUIDelete($Viewgui)
    ExitLoop
    Case $Button2
    GUISetState(@SW_HIDE)
    GUIDelete($Viewgui)
    ExitLoop
    Case $Button3
    GUISetState(@SW_HIDE)
    GUIDelete($Viewgui)
    ExitLoop

    [/autoit] [autoit][/autoit] [autoit]

    EndSwitch
    ;~ For $i = 1 To UBound($LV_Agent)
    ;~ if _GUICtrlListView_GetTopIndex($hLV_Kontakt[$i])<_GUICtrlListView_GetTopIndex($hLV_Agent[$i]) then
    ;~ _GUICtrlListView_Scroll($hLV_Agent[$i], 0, -12)
    ;~ elseif _GUICtrlListView_GetTopIndex($hLV_Kontakt[$i])>_GUICtrlListView_GetTopIndex($hLV_Agent[$i]) then
    ;~ _GUICtrlListView_Scroll($hLV_Agent[$i], 0, +12)
    ;~ EndIf
    ;~ Next
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _Array2DSearch($avArray, $vWhat2Find, $iDim = -1, $iStart = 0, $iEnd = 0, $iCaseSense = 0, $fPartialSearch = False, $1stFound = False)
    Local $error = 0, $1D, $arFound[1] = [0]
    If $1stFound Then $arFound[0] = -1
    If (Not IsArray($avArray)) Then
    SetError(1)
    Return 0
    EndIf
    Local $UBound2nd = UBound($avArray, 2)
    If @error = 2 Then $1D = True
    If ($iEnd = 0) Or ($iEnd = -1) Then $iEnd = UBound($avArray) - 1
    If $iStart = -1 Then $iStart = 0
    If $iCaseSense = -1 Then $iCaseSense = 0
    If $iCaseSense <> 0 Then $iCaseSense = 1
    Select
    Case ($iDim > $UBound2nd) Or ($iDim < -1)
    $error += 2
    Case ($iStart < 0) Or ($iStart > UBound($avArray) - 1)
    $error += 4
    Case ($iEnd < $iStart) Or ($iEnd > UBound($avArray) - 1)
    $error += 8
    EndSelect
    If $error <> 0 Then
    SetError($error)
    Return 0
    EndIf
    If $fPartialSearch <> True Then $fPartialSearch = False
    If $1D Then
    For $i = $iStart To $iEnd
    Select
    Case $iCaseSense = 0 And (Not $fPartialSearch)
    If $avArray[$i] = $vWhat2Find Then
    If $1stFound Then
    $arFound[0] = $i
    Return $arFound
    Else
    ReDim $arFound[UBound($arFound) + 1]
    $arFound[UBound($arFound) - 1] = $i
    $arFound[0] += 1
    EndIf
    EndIf
    Case $iCaseSense = 1 And (Not $fPartialSearch)
    If $avArray[$i] == $vWhat2Find Then
    If $1stFound Then
    $arFound[0] = $i
    Return $arFound
    Else
    ReDim $arFound[UBound($arFound) + 1]
    $arFound[UBound($arFound) - 1] = $i
    $arFound[0] += 1
    EndIf
    EndIf
    Case $iCaseSense = 0 And $fPartialSearch
    If StringInStr($avArray[$i], $vWhat2Find) Then
    If $1stFound Then
    $arFound[0] = $i
    Return $arFound
    Else
    ReDim $arFound[UBound($arFound) + 1]
    $arFound[UBound($arFound) - 1] = $i
    $arFound[0] += 1
    EndIf
    EndIf
    Case $iCaseSense = 1 And $fPartialSearch
    If StringInStr($avArray[$i], $vWhat2Find, 1) Then
    If $1stFound Then
    $arFound[0] = $i
    Return $arFound
    Else
    ReDim $arFound[UBound($arFound) + 1]
    $arFound[UBound($arFound) - 1] = $i
    $arFound[0] += 1
    EndIf
    EndIf
    EndSelect
    Next
    Else
    For $i = $iStart To $iEnd
    If $iDim = -1 Then
    Select
    Case $iCaseSense = 0 And (Not $fPartialSearch)
    For $k = 0 To $UBound2nd - 1
    If $avArray[$i][$k] = $vWhat2Find Then
    If $1stFound Then
    $arFound[0] = $i & '|' & $k
    Return $arFound
    Else
    ReDim $arFound[UBound($arFound) + 1]
    $arFound[UBound($arFound) - 1] = $i & '|' & $k
    $arFound[0] += 1
    EndIf
    EndIf
    Next
    Case $iCaseSense = 1 And (Not $fPartialSearch)
    For $k = 0 To $UBound2nd - 1
    If $avArray[$i][$k] == $vWhat2Find Then
    If $1stFound Then
    $arFound[0] = $i & '|' & $k
    Return $arFound
    Else
    ReDim $arFound[UBound($arFound) + 1]
    $arFound[UBound($arFound) - 1] = $i & '|' & $k
    $arFound[0] += 1
    EndIf
    EndIf
    Next
    Case $iCaseSense = 0 And $fPartialSearch
    For $k = 0 To $UBound2nd - 1
    If StringInStr($avArray[$i][$k], $vWhat2Find) Then
    If $1stFound Then
    $arFound[0] = $i & '|' & $k
    Return $arFound
    Else
    ReDim $arFound[UBound($arFound) + 1]
    $arFound[UBound($arFound) - 1] = $i & '|' & $k
    $arFound[0] += 1
    EndIf
    EndIf
    Next
    Case $iCaseSense = 1 And $fPartialSearch
    For $k = 0 To $UBound2nd - 1
    If StringInStr($avArray[$i][$k], $vWhat2Find, 1) Then
    If $1stFound Then
    $arFound[0] = $i & '|' & $k
    Return $arFound
    Else
    ReDim $arFound[UBound($arFound) + 1]
    $arFound[UBound($arFound) - 1] = $i & '|' & $k
    $arFound[0] += 1
    EndIf
    EndIf
    Next
    EndSelect
    Else
    Select
    Case $iCaseSense = 0 And (Not $fPartialSearch)
    If $avArray[$i][$iDim] = $vWhat2Find Then
    If $1stFound Then
    $arFound[0] = $i & '|' & $iDim
    Return $arFound
    Else
    ReDim $arFound[UBound($arFound) + 1]
    $arFound[UBound($arFound) - 1] = $i & '|' & $iDim
    $arFound[0] += 1
    EndIf
    EndIf
    Case $iCaseSense = 1 And (Not $fPartialSearch)
    If $avArray[$i][$iDim] == $vWhat2Find Then
    If $1stFound Then
    $arFound[0] = $i & '|' & $iDim
    Return $arFound
    Else
    ReDim $arFound[UBound($arFound) + 1]
    $arFound[UBound($arFound) - 1] = $i & '|' & $iDim
    $arFound[0] += 1
    EndIf
    EndIf
    Case $iCaseSense = 0 And $fPartialSearch
    If StringInStr($avArray[$i][$iDim], $vWhat2Find) Then
    If $1stFound Then
    $arFound[0] = $i & '|' & $iDim
    Return $arFound
    Else
    ReDim $arFound[UBound($arFound) + 1]
    $arFound[UBound($arFound) - 1] = $i & '|' & $iDim
    $arFound[0] += 1
    EndIf
    EndIf
    Case $iCaseSense = 1 And $fPartialSearch
    If StringInStr($avArray[$i][$iDim], $vWhat2Find, 1) Then
    If $1stFound Then
    $arFound[0] = $i & '|' & $iDim
    Return $arFound
    Else
    ReDim $arFound[UBound($arFound) + 1]
    $arFound[UBound($arFound) - 1] = $i & '|' & $iDim
    $arFound[0] += 1
    EndIf
    EndIf
    EndSelect
    EndIf
    Next
    EndIf
    Return $arFound
    EndFunc ;==>_Array2DSearch

    [/autoit] [autoit][/autoit] [autoit]

    Func WM_NOTIFY($hWnd, $msgID, $wParam, $lParam)
    Local $tagNMHDR, $event, $hwndFrom, $code, $aItems
    $tagNMHDR = DllStructCreate("int;int;int", $lParam)
    $code = DllStructGetData($tagNMHDR, 3)
    If @error Then Return 0
    ;ConsoleWrite($wParam & " " & $LV_Agent[$iActiveTab] & @CRLF)
    Switch $wParam
    Case $LV_Agent[$iActiveTab]
    Switch $code
    Case $NM_CLICK
    $iActiveAgent = GUICtrlRead($LV_Agent[$iActiveTab])
    $aItems = _GUICtrlListView_GetSelectedIndices($LV_Agent[$iActiveTab],True)
    If IsArray($aItems) And $aItems[0] <> 0 Then
    $iActiveAgent = $aItems[1]
    ;ConsoleWrite($iActiveAgent & " Name " & GUICtrlRead($iActiveAgent) & @CRLF)
    _GUICtrlListView_EnsureVisible($LV_Kontakt[$iActiveTab], $iActiveAgent)
    _GUICtrlListView_SetItemSelected($LV_Kontakt[$iActiveTab], $iActiveAgent)
    EndIf
    Case $LVN_HOTTRACK
    $iActiveAgent = GUICtrlRead($LV_Agent[$iActiveTab])
    $aItems = _GUICtrlListView_GetSelectedIndices($LV_Agent[$iActiveTab],True)
    If IsArray($aItems) ANd $aItems[0] <> 0 Then
    $iActiveAgent = $aItems[1]
    ;ConsoleWrite($iActiveAgent & " Name " & GUICtrlRead($iActiveAgent) & @CRLF)
    _GUICtrlListView_EnsureVisible($LV_Kontakt[$iActiveTab], $iActiveAgent)
    _GUICtrlListView_SetItemSelected($LV_Kontakt[$iActiveTab], $iActiveAgent)
    If _GUICtrlListView_GetTopIndex($LV_Agent[$iActiveTab]) > _GUICtrlListView_GetTopIndex($LV_Kontakt[$iActiveTab]) Then
    _GUICtrlListView_Scroll($LV_Kontakt[$iActiveTab], 0, +12)
    EndIf
    EndIf
    EndSwitch
    Case $LV_Kontakt[$iActiveTab]
    Switch $code
    Case $NM_CLICK
    $iActiveAgent = GUICtrlRead($LV_Kontakt[$iActiveTab])
    $aItems = _GUICtrlListView_GetSelectedIndices($LV_Kontakt[$iActiveTab],True)
    If IsArray($aItems) And $aItems[0] <> 0 Then
    $iActiveAgent = $aItems[1]
    ;ConsoleWrite($iActiveAgent & " Name " & GUICtrlRead($iActiveAgent) & @CRLF)
    _GUICtrlListView_EnsureVisible($LV_Agent[$iActiveTab], $iActiveAgent)
    _GUICtrlListView_SetItemSelected($LV_Agent[$iActiveTab], $iActiveAgent)
    EndIf
    Case $LVN_HOTTRACK
    $iActiveAgent = GUICtrlRead($LV_Kontakt[$iActiveTab])
    $aItems = _GUICtrlListView_GetSelectedIndices($LV_Kontakt[$iActiveTab],True)
    If IsArray($aItems) ANd $aItems[0] <> 0 Then
    $iActiveAgent = $aItems[1]
    ;ConsoleWrite($iActiveAgent & " Name " & GUICtrlRead($iActiveAgent) & @CRLF)
    _GUICtrlListView_EnsureVisible($LV_Agent[$iActiveTab], $iActiveAgent)
    _GUICtrlListView_SetItemSelected($LV_Agent[$iActiveTab], $iActiveAgent)
    if _GUICtrlListView_GetTopIndex($LV_Kontakt[$iActiveTab])<_GUICtrlListView_GetTopIndex($LV_Agent[$iActiveTab]) then
    _GUICtrlListView_Scroll($LV_Agent[$iActiveTab], 0, -12)
    EndIf
    EndIf
    Case $LVN_COLUMNCLICK ; Eine Spalte wurde angeklickt
    $Anzahl = _GUICtrlListView_GetItemCount($LV_Agent[$iActiveTab])
    For $i = 1 To $Anzahl
    $Item = _GUICtrlListView_GetItemText($LV_Agent[$iActiveTab],$i-1) ; Agent
    $Subitem = _GUICtrlListView_GetItemText($LV_Kontakt[$iActiveTab],$i-1) ;
    _Array2DAdd($Sortarray, $Item &"|"&$Subitem)
    Next
    _GUICtrlListView_BeginUpdate($LV_Kontakt[$iActiveTab])
    _GUICtrlListView_BeginUpdate($LV_Agent[$iActiveTab])
    _GUICtrlListView_SortItems($LV_Kontakt[$iActiveTab],GUICtrlGetState($LV_Kontakt[$iActiveTab]))
    For $i = 0 To UBound($Sortarray) - 2
    $Item = _GUICtrlListView_GetItemText($LV_Agent[$iActiveTab],$i) ; Agent
    $Subitem = _GUICtrlListView_GetItemText($LV_Kontakt[$iActiveTab],$i)
    If $Item = $Sortarray[$i+1][0] AND $SubItem <> $Sortarray[$i+ 1][1] AND $Subitem <> 0 Then
    $Sortsearch = _Array2DSearch($Sortarray, $Subitem, -1,0,0,0, False, True)
    $Sortsearchsplit = StringSplit($Sortsearch[0], '|')
    _GUICtrlListView_SetItemText($LV_Agent, $i, $Sortarray[$Sortsearchsplit[1]][$Sortsearchsplit[2]-1], -1)
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $Sortarray[$Sortsearchsplit[1]][$Sortsearchsplit[2]-1] = ' & $Sortarray[$Sortsearchsplit[1]][$Sortsearchsplit[2]-1] & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    EndIf
    Next
    _GUICtrlListView_EndUpdate($LV_Kontakt[$iActiveTab])
    _GUICtrlListView_EndUpdate($LV_Agent[$iActiveTab])
    $Sortarray = "0"

    [/autoit] [autoit][/autoit] [autoit]

    EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_NOTIFY
    ;------------------------------------------------------------------------------------------------------------
    ;
    ; Function _Array2DAdd(ByRef $avArray, $sValue='')
    ;
    ; Description Redim Array Size and add an Array element at last position
    ; Works with any occurences in 2nd Dimension
    ; Works also with 1D-Array
    ;
    ; Parameter $avArray Given Array
    ; optional $sValue Value of new Element, parts must be seperate with '|'
    ;
    ; Return Succes -1
    ; Failure 0 and set @error
    ; @error = 1 given array is not array
    ; @error = 2 given parts of Element too less/much
    ;
    ; Author BugFix ([email='bugfix@autoit.de'][/email])
    ;------------------------------------------------------------------------------------------------------------
    Func _Array2DAdd(ByRef $avArray, $sValue='')
    If ( Not IsArray($avArray) ) Then
    SetError(1)
    Return 0
    EndIf
    Local $i
    Local $UBound2nd = UBound($avArray,2)
    If @error = 2 Then
    ReDim $avArray[UBound($avArray)+1]
    $avArray[UBound($avArray)-1] = $sValue
    Else
    Local $arValue
    ReDim $avArray[UBound($avArray)+1][$UBound2nd]
    If $sValue = '' Then
    For $i = 0 To $UBound2nd-2
    $sValue &= '|'
    Next
    EndIf
    $arValue = StringSplit($sValue, '|')
    If $arValue[0] <> $UBound2nd Then
    SetError(2)
    Return 0
    EndIf
    For $i = 0 To $UBound2nd-1
    $avArray[UBound($avArray)-1][$i] = $arValue[$i+1]
    Next
    EndIf
    Return -1
    EndFunc ;==>_Array2DAdd

    [/autoit]

    Der Debug liefert mir den Namen, der eigentlich richtig ist, allerdings wird es eben in der Ersten Listview nicht geändert.

    Kennt jemand eine Lösung dazu?
    --EDIT--
    Hat sich erledigt, man sollte auch einen Arrayindex angeben, wenn man sich auf ein array bezieht...