Function Reference

_GUICtrlListDeleteItem

Delete an Item from the List

#Include <GuiList.au3>
_GUICtrlListDeleteItem($h_listbox, $i_index)

 

Parameters

$h_listbox control id/control hWnd
$i_index Zero-based index of item to delete

 

Return Value

The return value is a count of the strings remaining in the list.
The return value is $LB_ERR if the $i_index parameter specifies an
index greater than the number of items in the list.

 

Remarks

None.

 

Related

_GUICtrlListAddItem, _GUICtrlListInsertItem, _GUICtrlListClear

 

Example


#include <GUIConstants.au3>
#include <GuiList.au3>

Opt ('MustDeclareVars', 1)

Dim $msg, $ret
Dim $listbox, $button

GUICreate("ListBox Delete Item Demo", 400, 250, -1, -1)

$listbox = GUICtrlCreateList("", 125, 40, 180, 120)
GUICtrlSetData($listbox, "test1|test2|test3|")
$button = GUICtrlCreateButton("Delete item #2", 150, 160, 120, 40)

GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $button
            $ret = _GUICtrlListDeleteItem ($listbox, 1)
            If ($ret == $LB_ERR) Then
                MsgBox(16, "Error", "Unknown error from _GUICtrlListDeleteItem")
            EndIf
    EndSelect
WEnd