hroberts Posted December 11, 2015 Posted December 11, 2015 I have a 2 column array. Column 1 is the Name of an OU, column 2 is the FQDN. I want to bring the information from this array into the ComboBox, displaying column 1, but selecting column 2 to be used further in the script. I believe I have to extract the 2 columns into 2 different arrays but I am not sure how/what to do to get this to work. Can anyone help me out with getting this to work? Thanks,
ahmet Posted December 11, 2015 Posted December 11, 2015 This might help youGlobal $aData[3][2] ; this array contains OU and FQDN Global $sComboData="" For $i=0 To 2 ;just to populate array quickly $aData[$i][0]="OU" & $i $aData[$i][1]="FQDN" & $i $sComboData=$sComboData & $aData[$i][0] & "|" Next $hMain=GUICreate("Test") $idCombo=GUICtrlCreateCombo("",10,10) GUICtrlSetData($idCombo,$sComboData) GUISetState() While 1 Switch GUIGetMsg() Case -3 Exit Case $idCombo $sTextSelected=GUICtrlRead($idCombo) ;when selection occurs get the text that is displayed $iFoundItem=-1 For $i=0 To UBound($aData,1)-1 ; search for selected text in array of your data If $sTextSelected==$aData[$i][0] Then $iFoundItem=$i ; store the index where we found our selection for further use if necessary ConsoleWrite("OU=" & $sTextSelected & ", FQDN=" & $aData[$i][1] & @CRLF) EndIf Next EndSwitch WEndYou could have posted some code
water Posted December 11, 2015 Posted December 11, 2015 Fill the combobox with the elements from column 1. When a user selects an entry you get the displayed text in return. With this text loop through the array and grab the corresponding text from column 2. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now