Problem

How to use lists in textbox


Solution

To load a list you can use the following code:

textBox1.listAddItem("Red");
textBox1.listAddItem("Yellow");
textBox1.listAddItem("Green");
textBox1.listAddItem("White");
textBox1.listAddItem("Black");

To check which item is selected:

textBox1.getSelectedItem(); //Return the value
textBox1.getSelectedIndex(); //Return the index

Other methods are:

textBox1.getListItemCount(); //Return the number of elements
textBox1.getListItemAt(<index>); //Returns the value of the index
textBox1.getListItems(); //Returns an array of objects contains all elements
textBox1.listClear(); //Remove all items

Published in Mon, 13 December 2010 11:20