# Function Reference

# _GUICtrlListView_GetItemText

Retrieves the text of an item or subitem

#include <GuiListView.au3>
_GUICtrlListView_GetItemText ( $hWnd, $iIndex [, $iSubItem = 0] )

## Parameters

$hWnd | Control ID/Handle to the control
$iIndex | 0-based index of the item
$iSubItem | [optional] 1-based sub item index

## Return Value

Returns the item or subitem text.

## Remarks

To retrieve the item text, set $iSubItem to 0.
To retrieve the text of a subitem, set $iSubItem to the 1-based subitem's index.

## Related

_GUICtrlListView_GetItemTextArray, _GUICtrlListView_GetItemTextString, _GUICtrlListView_SetItemText

## Example

### Example 1

    #include <GUIConstantsEx.au3>
    #include <GuiListView.au3>
    #include <MsgBoxConstants.au3>

    Example()

    Func Example()
        GUICreate("ListView Get/Set Item Text (v" & @AutoItVersion & ")", 400, 300)
        Local $idListview = GUICtrlCreateListView("", 2, 2, 394, 268)
        GUISetState(@SW_SHOW)

        ; Set ANSI format
    ;~     _GUICtrlListView_SetUnicodeFormat($idListview, False)

        ; Add columns
        _GUICtrlListView_AddColumn($idListview, "Items", 100)

        ; Add items
        _GUICtrlListView_AddItem($idListview, "Item 0")
        _GUICtrlListView_AddItem($idListview, "Item 1")
        _GUICtrlListView_AddItem($idListview, "Item 2")

        ; Set item 1 text
        _GUICtrlListView_SetItemText($idListview, 1, "New Item 1")
        MsgBox($MB_SYSTEMMODAL, "Information", "Item 1 Text: " & _GUICtrlListView_GetItemText($idListview, 1))

        ; Loop until the user exits.
        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE
        GUIDelete()
    EndFunc   ;==>Example

### Example 2 : _GUICtrlListView_SetItemText() with $iSubItem = - 1

    #include <GUIConstantsEx.au3>
    #include <GuiListView.au3>
    #include <MsgBoxConstants.au3>

    Example()

    Func Example()
        Local $idListview
        GUICreate("ListView Set Item Text", 400, 300)
        $idListview = GUICtrlCreateListView("Item        |subitem        |subitem        ", 2, 2, 394, 268)
        GUISetState(@SW_SHOW)

        ; Add row 0
        GUICtrlCreateListViewItem("Item 0|SubItem1|SubItem2", $idListview)
        MsgBox($MB_TOPMOST, "", "Before modifying all text at once")

        ; Alter all text at once in row 0
        _GUICtrlListView_SetItemText($idListview, 0, "Item 0_alt|SubItem1_alt|SubItem2_alt", -1)
        MsgBox($MB_TOPMOST, "Parameter $iSubItem = - 1", "All text has been altered at once")

        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE
        GUIDelete()
    EndFunc   ;==>Example