#90458 - 2002-12-09 10:08 PM
return list of elements in a combobox/list box
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
I need to collect all the elements that have added to a combobox.
|
|
Top
|
|
|
|
#90459 - 2002-12-09 11:52 PM
Re: return list of elements in a combobox/list box
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
Hey Rad ... you didn't say "into what" ... assume you want to dyna-create an array and download into that, heres a script that populates a ComboBox, then when you click the "Collect" button, walks the list (ListCount & Value) and fills an array:
code:
Break On $Form = CreateObject("Kixtart.Form") $Form.FontSize = 10 ; Populate the ComboBox ... $ComboBox = $Form.ComboBox $ComboBox.Size = 100,100 $ComboBox.Center $ComboBox.List = 2,4,6,8,10,12,14,16,18,20,22,24 ; Collect the information ... $Button = $Form.Button $Button.Size = 100,30 $Button.Text = "Collect" $Button.Center $Button.Top = $ComboBox.Bottom + 10 $Button.OnClick = "Button_Click" Function Button_Click ; Create array and populate ... Dim $Array[$ComboBox.ListCount] For $i = 0 to UBound($Array) $ComboBox.ListIndex = $i $Array[$i] = $ComboBox.Value Next ; Dump to console For Each $Element In $Array ?"Element=" $Element Next EndFunction
$Form.Show While $Form.Visible $=Execute($Form.DoEvents) Loop
|
|
Top
|
|
|
|
#90460 - 2002-12-10 01:41 AM
Re: return list of elements in a combobox/list box
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
that is basically what I wanted to do...
The section of inquisitor that collects the network drives dumps the result directly into the combobox...
The section of mapdrive I am looking at, needs to collect a list of available drive letters for the new drive mapping.
Since reading the combox box has to be done item by item, I may as well make an array at the time of collecting the in use drives, and avoid reading the combobox list
|
|
Top
|
|
|
|
#90462 - 2002-12-10 05:34 AM
Re: return list of elements in a combobox/list box
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
so I can populate a combo box with unused drive letters.
|
|
Top
|
|
|
|
#90464 - 2002-12-10 05:47 AM
Re: return list of elements in a combobox/list box
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
I know... I thought it might behave like an array, so I wouldn't have to create one.
But it doesn't work that way, so I'll have to stop being lazy and make one when I populate the first combobox... then I can just read the array instead of each listitem
code:
used drives combo new drive combo e: f: g: h: i: j: k:
|
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
1 registered
(Allen)
and 483 anonymous users online.
|
|
|