Jump to content

Recommended Posts

Posted

Can someone tell me where I've gone wrong here - it keeps returning the same value - IT Infrastructure

I want it to return the selection from the combo box.

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#region ### START Koda GUI section ### Form=
Local $em, $Combo1
$Form1 = GUICreate("Form1", 424, 170, 192, 114)
$Input1 = GUICtrlCreateInput("IP Address", 64, 48, 121, 21)
$Combo1 = GUICtrlCreateCombo("Combo1", 216, 48, 185, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "|Name1|Name2|Name3l|Name4|Name5|Name6|IT Infrastructure", "IT Infrastructure")
$Button1 = GUICtrlCreateButton("Button1", 288, 96, 81, 33)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
$em = GUICtrlRead($Combo1)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop ;EndSelect
        Case $msg = $Button1
            #Region --- CodeWizard generated code Start ---
;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=None
MsgBox(0,"Test", $em)
#EndRegion --- CodeWizard generated code End ---

    EndSelect
WEnd
Exit
Posted

That is because you read the value of the control before displaying the GUI, not when the Button is clicked.

Doh !! I'm such an idiot. Thanks.

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
×
×
  • Create New...