Function Reference


_GUICtrlComboBox_GetLBText

Retrieve a string from the list of a ComboBox

#include <GuiComboBox.au3>
_GUICtrlComboBox_GetLBText ( $hWnd, $iIndex, ByRef $sText )

Parameters

$hWnd Control ID/Handle to the control
$iIndex 0-based index to Retrieve from
$sText Variable that will receive the string

Return Value

Success: the text of the string.
Failure: -1.

Remarks

To get currently selected text use _GUICtrlComboBox_GetCurSel() in order to get proper index.

Related

_GUICtrlComboBox_GetLBTextLen

Example

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

Example()

Func Example()
        Local $sText, $idCombo

        ; Create GUI
        GUICreate("ComboBox Get LB Text", 400, 296)
        $idCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
        GUISetState(@SW_SHOW)

        ; Add files
        _GUICtrlComboBox_BeginUpdate($idCombo)
        _GUICtrlComboBox_AddDir($idCombo, @WindowsDir & "\*.exe")
        _GUICtrlComboBox_EndUpdate($idCombo)

        ; Get LB Text
        _GUICtrlComboBox_GetLBText($idCombo, 2, $sText)
        MsgBox($MB_SYSTEMMODAL, "Information", "LB Text: " & $sText)

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