Skip to main content

The List Item Collections:




The ListItemCollection object is a collection of ListItem objects. Each ListItem object represents one item in the list. Items in a ListItemCollection are numbered from 0.
When the items into a list box are loaded using strings like: lstcolor.Items.Add("Blue") . then both the Text and Value properties of the list item are set to the string value you specify. To set it differently you must create a list item object and then add that item to the collection.
The ListItem Collection Editor is used to add item to a drop-down list or list box. This is used to create a static list of items. To display the Collection Editor select Edit item from the smart tag menu, or select the control and then click the ellipsis button from the Item property in the Properties window.
Common Properties of List Item Collection:
Property
Description
Item(integer)
A ListItem object that represents the item at the specified index.
Count
The number of items in the collection.
Common methods of List Item Collection:
Methods
Description
Add(string)
Adds a new item to the end of the collection and assigns the string parameter to the Text property of the item.
Add(ListItem)
Adds a new item to the end of the collection.
Insert(integer, string)
Inserts an item at the specified index location in the collection, and assigns the string parameter to the Text property of the item.
Insert(integer, ListItem)
Inserts the item at the specified index location in the collection.
Remove(string)
Removes the item with the Text value same as the string.
Remove(ListItem)
Removes the specified item.
RemoveAt(integer)
Removes the item at the specified index as the integer.
Clear
Removes all the items of the collection.
FindByValue(string)
Returns the item whose Value is same as the string.
FindByValue(Text)
Returns the item whose Text is same as the string.

Comments

Popular posts from this blog

Export html table to csv using javascript

<table>     <tr><th>Name</th><th>Age</th><th>Country</th></tr>     <tr><td>MANOJ</td><td>26</td><td>INDIA</td></tr>     <tr><td>KRISHAN</td><td>19</td><td>INDIA</td></tr>     <tr><td>SUSHEEL</td><td>32</td><td>INDIA</td></tr> </table> <button onclick="Export_CSV ()">Export HTML table to CSV file</button> function download_csv(csv, filename) {     var csvFile;     var downloadLink;     csvFile = new Blob([csv], {type: "text/csv"});     downloadLink = document.createElement("a");     downloadLink.download = filename;     downloadLink.href = window.URL.createObjectURL(csvFile);     downloadLink.style.d...

Difference between SQL Function and Stored Procedure

The main difference between functions and stored procedures  are given bellow: Function(User Defined) It returns only one value We can’t use transaction in function Only have input parameter We can’t called SP from function We can’t use exception handling using Try-Catch block in function We can use function in select/where/having statement Stored Procedure (Store Procedure) It returns zero, single or multiple values We can use transaction in SP Can have input/output parameter We can called function from SP We can use exception handling using Try-Catch block in SP We can’t use SP in select/where/having statement