Listbox is blank

new BookmarkLockedFalling
veneff
New Member
*

veneff Avatar

Posts: 29

Post by veneff on Jan 22, 2009 16:56:38 GMT -5

Is there a way to display a selection in the LISTBOX on when the page is initially built? Right now it always comes up blank until a selection manually made. I would at least like to display the 1st element of the array (item 0). Note that I am using the drop down version with 1 line height specified.

Vance
Psycho
Full Member
***

Psycho Avatar

Posts: 196

Post by Psycho on Jan 22, 2009 18:40:01 GMT -5

Hmmmm........it should display the first element.

What happens with this code?

 print "Listbox selection"
dim item$(3)
item$(0)="Item Zero"
item$(1)="Item One"
item$(2)="Item Two"
item$(3)="Item Three"
listbox #menu, item$(),1
wait


John "Psycho" Siejkowski
veneff
New Member
*

veneff Avatar

Posts: 29

Post by veneff on Jan 23, 2009 8:23:26 GMT -5

Hi John,

While I was waiting for a response, I wrote a test program similar to yours and it did work correctly.
What I found in the program I am working on is that for some reason the element after the last assigned element of the array is being selected which, of course, is null (""). I would think that it would default to the first element.
To correct this I found using the SELECT(0) method to force the initial selection to the first element.

Thanks for the quick reply!

Vance