ListBox Control:



This control is used to display group of items to user so that user can select a single item or group of items randomly or Range of items

Properties and Methods with ListBox class

SNO
Property and options
Type
Description
01
Items (Collection)
Object Collection Class
Stores all the elements in the form of collection and each element is identified using index value
02
Selection Mode
     None
     One(Default)
     MultiSimple
     MultiExtended
enum
None: User can’t select any item from the list
One: User can select single item from the list
MultiSimple: User can select single item or group of items randomly without holding any key
MultiExtended: User can select single item without hold any key or range of items by holding shift key
03
Sorted
        True
        False(Default)
bool
True: Items are arranged in the alphabetical order
False: Items are not arranged in the alphabetical order

Properties at Run Time

SNO
Property and options
Type
Description
01
SelectedItem
object
Sets or gets the item value selected
02
SelectedIndex
object
Sets or gets index value of the item selected
03
SelectedItems
ObjectCollection Class
Gets the collection of items selected
04
SelectedIndices
ObjectCollection Class
Gets the collection of indices of the items selected

Properties with Items Collection

SNO
Properties and options
Type
Description
01
Count
int
Returns the count of items present in the items collection

Method with Item Collection of the ListBox

SNO
Properties and options
Type
Description
01
Add(object Item)

Used to add a new item to the items collection of the ListBox, by default the item is added at the end of the collection provided sorted is false
02
Insert(int Index, object Item)

Used to add a new item to the items collection of the ListBox at the given index,  the item is added at the given index of the collection provided sorted is false
03
Remove(object Item)

Used to delete an item from the items collection of the ListBox using the item value
04
RemoveAt(int Index)

Used to delete an item from the items collection of the ListBox using the index value
05
Clear()

Used to delete all items from the items collection of the ListBox


No comments:

Post a Comment