Page 1 of 1 1
Topic Options
#90458 - 2002-12-09 10:08 PM return list of elements in a combobox/list box
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I need to collect all the elements that have added to a combobox.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#90459 - 2002-12-09 11:52 PM Re: return list of elements in a combobox/list box
Shawn Administrator Offline
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 Offline
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
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#90461 - 2002-12-10 05:08 AM Re: return list of elements in a combobox/list box
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I wonder why you would need to read the whole list?
_________________________
!

download KiXnet

Top
#90462 - 2002-12-10 05:34 AM Re: return list of elements in a combobox/list box
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
so I can populate a combo box with unused drive letters.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#90463 - 2002-12-10 05:38 AM Re: return list of elements in a combobox/list box
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
you are really doing something I can't follow.
reading all from combobox... rather not the way used to use it.
_________________________
!

download KiXnet

Top
#90464 - 2002-12-10 05:47 AM Re: return list of elements in a combobox/list box
Radimus Moderator Offline
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:

_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#90465 - 2002-12-10 06:28 AM Re: return list of elements in a combobox/list box
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
same thing with other objects.
there is this .tag-property which can store array but you can't use that array directly in expressions, like in for each loops.
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 988 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.066 seconds in which 0.034 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org