Jump to content

veriable to populate combo box

Recommended Posts

Hi Guys

sorry for this Question but Im stumped

I have array of names (ie) 10 and I want to populate a combox box with the array

I can hard code them but in the event the array names incress/decress needs to reflect in the combo box selections.

Link to post
Share on other sites
  • Moderators

Hi, GNGNUT. I am doing something similar in a project right now. I have a 2d array, and am using one column to populate the combo box, as shown below. That might point you in the right direction.

;Combo Boxes
$Pkgs = GUICtrlCreateCombo("", 8, 80, 400, 25)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")

For $i = 1 To UBound($aArray) - 1
  GUICtrlSetData($Pkgs, $aArray[$i][0], "")

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to post
Share on other sites

If you want to do it in a direct manner, populate the list via the delimited string, and pass it into GuiCtrlSetData()

Local $asArray[5] ; Example Array
$asArray[0] = "Zero"
$asArray[1] = "One"
$asArray[2] = "Two"
$asArray[3] = "Three"
$asArray[4] = "Four"
Local $sInput = ""

For $data in $asArray
  If $sInput = "" Then
    $sInput = $data
    $sInput&= "|" & $data
GUICtrlSetData($ComboBox, "") ; I have a habit of clearing the data first =/
GUICtrlSetData($ComboBox, $sInput)
Edited by mechaflash213

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”


Link to post
Share on other sites

$iRval = _SQL_GetTable2d(-1,"EXEC sp_databases" ,$aData,$iRows,$iColumns) ;=> command line to retrive data back
;~ _ArrayDisplay($Adata)
For $i = 1 To UBound($aData) - 1
GUICtrlSetData($IVTables, $aData[$i][0],"")

Thank you for your help guys and for the push ;) this was the final coding for this task

Edited by GNGNUT
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...