DIM, Listbox.

Laura Brody laura at hvcomputer.com
Thu Aug 20 09:02:33 PDT 2009


Quoting "Kroboth, Joe" <joe_kroboth at chernay.com>:

> Is there any way to set an array size with a variable?

No.

>
> I'm trying to count a bunch of items, Build an array based on the   
> number of items, Populate the array with the items, then show a   
> listbox of the items.   Maybe I'm missing something.


The trick is to define the biggest array you will ever
possibly need (then double it to be sure), then when you
call listbox, have the size be the number of elements used
in the array. (Note that you can tell listbox to only
display part of the array elements, so count carefully).
If you don't give it a last entry position, it will just
display all elements, empty or full.

Examples:

dim fields(100)(10,*)

fields("1")="abc"
fields("2")="bcd"
fields("3")="cde"
x=listbox(fields,"1","3")

You can also do this:

x=listbox(fields,"2","4")

which will display only elements 2, 3 and 4 (which is blank).


I've been doing this for many years and it still works great.

> Thanks for your time.
>
>
> Joe Kroboth
> Chernay Printing, Inc
> joe_kroboth at chernay.com
>
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> http://mailman.celestial.com/mailman/listinfo/filepro-list
>



--
Laura Brody
+------------- Hudson Valley Computer Associates, Inc ----------+
| PO Box 859; 120 Sixth Street   http://www.hvcomputer.com      |
| Verplanck, NY 10596-0859       Voice mail: (914) 739-5004     |
+------ PC repair locally, filePro programming globally --------+


More information about the Filepro-list mailing list