Jump to content
Sign in to follow this  

Combo Box Array Question

Recommended Posts


Does anybody know how to display an array in a combo box I figured this would work (I also tried referencing the function by $ComboBox) but it was a no go.

Any help wpuld be great,


Dim $Combobox[10]
$ComboBox[0] = "test 1"
$ComboBox[1] = "test 2"

GuiCtrlCreatecombo("Test1", 10, 100, 130, 100)

Share this post

Link to post
Share on other sites

Dim $MyArray[3]
$MyArray[1] = 'Light'
$MyArray[2] = 'Bulb'

$Main = GUICreate('Main', 200, 100)
$Combo = GUICtrlCreateCombo('', 10, 10, 180, 100)
$Button = GUICtrlCreateButton('Populate Combo', 50, 40, 100, 30)


While 1
    $MSG = GUIGetMsg()  
    If $MSG = - 3 Then Exit
    If $MSG = $Button Then 
        GUICtrlSetData($Combo, PopulateComboArray($MyArray))

Func PopulateComboArray($nArray)
    Local $ReturnComboValue = ''
    For $i = 1 To UBound($nArray) - 1
        $ReturnComboValue = $ReturnComboValue & $nArray[$i] & '|'
    Return StringTrimRight($ReturnComboValue, 1)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this