Using array functions on ListItem or List properties

Using array functions on ListItem or List properties

Post by trw7a » Wed, 21 Dec 2005 07:33:41


I seem to recall there was a way to do this, but I keep getting
"not an array" errors when I try to use array functions like
ASCAN or ALEN on the ListItem and List properties of a combobox.

I am trying to put a method in a base combobox class that will
work regardless of how many items or columns are in the
combo's list. To determine the rows and columns in the ListItem,
I tried ALEN, but receive "not an array" errors.

Isn't there a way to determine this information about a combo?

-- TRW
_______________________________________
t r w 7
at
i x dot n e t c o m dot c o m
_______________________________________
 
 
 

Using array functions on ListItem or List properties

Post by Jack Jacks » Wed, 21 Dec 2005 09:47:42

On Mon, 19 Dec 2005 22:33:41 GMT, XXXX@XXXXX.COM (Tim



The ListCount property tells you how many rows. The ColumnCount
property tells you how many columns.

 
 
 

Using array functions on ListItem or List properties

Post by trw7a » Wed, 21 Dec 2005 16:46:27


4ax.com:



The problem with using the ColumnCount property is that
it does not necessarily indicate the number of columns
in the ListItem. It is the number of columns to display
in the drop down (of a combo) or the list (of a listbox).

For example, you can load the list with 5 columns of
information, but set ColumnCount to 2 so that only
the first two columns are displayed. This is a common
way to add other details about the items like IDs or
foreign key values but keep them hidden. I need to
determine the actual dimensions of the List array.

Any other ideas?

-- TRW
_______________________________________
t r w 7
at
i x dot n e t c o m dot c o m
_______________________________________
 
 
 

Using array functions on ListItem or List properties

Post by TWljaGVsIF » Wed, 21 Dec 2005 22:02:02

if you set the column count to the total, but set columnwidths to 0 for
invisible columns, you can access the data with list(row,column) even if it's
not displayed
 
 
 

Using array functions on ListItem or List properties

Post by trw7a » Thu, 22 Dec 2005 02:28:13


=?Utf-8?B?TWljaGVsIFJveQ==?= seemed to utter in



Yes, you can do that as well. It's a bit more work though
and I probably have hundreds of instances of comboboxes
and lists that do not use that method. I'm looking for a
solution that will work regardless of how the combobox
was initially populated and configured. I can't assume a
certain approach was used.

-- TRW
_______________________________________
t r w 7
at
i x dot n e t c o m dot c o m
_______________________________________
 
 
 

Using array functions on ListItem or List properties

Post by TWFya » Thu, 22 Dec 2005 18:42:02

Hi Tim,
If I get you wright, the RowSource of your list/combo might give you this
info.
hth
Mark
 
 
 

Using array functions on ListItem or List properties

Post by trw7a » Fri, 23 Dec 2005 02:13:29

=?Utf-8?B?TWFyaw==?= seemed to utter in
news: XXXX@XXXXX.COM :


It would if I wrote code to parse and unravel every possible
RowSource. That would be a huge undertaking when you consider
there are 10 possible RowSource types and each one would
require its own potentially complex logic to determine the
resulting data that would fill the list.

I remain stunned as to why these two properties (ListItem and List)
are called "arrays" in the documentation, but the only thing
about them that acts like an array is the ability to reference
their contents using array notation: This.ListItem[x, y]. None
of the array functions can be used on them and when you try
to reference elements of the list that are *way* out of range,
you get no errors. For example, given a small combo holding
5 rows and 2 columns, the following simply returns an empty
string: myCombo.ListItem[27, 12] Calling these properties
"arrays" I think is a stretch.

Amazing that there is no simple way to determine the size
of the ListItem and List properties!

-- TRW
_______________________________________
t r w 7
at
i x dot n e t c o m dot c o m
_______________________________________