Function Reference


_GUICtrlListBox_DeleteString

Delete a string

#include <GuiListBox.au3>
_GUICtrlListBox_DeleteString ( $hWnd, $iIndex )

Parameters

$hWnd Control ID/Handle to the control
$iIndex 0-based index of the string to be deleted

Return Value

Success: the count of strings remaining.
Failure: -1.

Related

_GUICtrlListBox_AddFile, _GUICtrlListBox_AddString, _GUICtrlListBox_InsertString, _GUICtrlListBox_ResetContent

Example

#include <GUIConstantsEx.au3>
#include <GuiListBox.au3>

Example()

Func Example()
        Local $idListBox

        ; Create GUI
        GUICreate("List Box Delete String", 400, 296)
        $idListBox = GUICtrlCreateList("", 2, 2, 396, 296)

        GUISetState(@SW_SHOW)

        ; Add strings
        _GUICtrlListBox_BeginUpdate($idListBox)
        For $iI = 1 To 9
                _GUICtrlListBox_AddString($idListBox, StringFormat("%d : List box string", $iI))
        Next
        _GUICtrlListBox_EndUpdate($idListBox)

        ; Delete middle string
        _GUICtrlListBox_DeleteString($idListBox, 4)

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