Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 Lab5 ListBox Control Properties, Methods and Events.

Similar presentations


Presentation on theme: "Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 Lab5 ListBox Control Properties, Methods and Events."— Presentation transcript:

1 Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 Lab5 ListBox Control Properties, Methods and Events

2 Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 2 ListBox An input box that displays a list of items from which a user can make the selection. Initializing the list box 1. You can initialize such list boxes from the List property (Design-time). 2. Initializing list boxes using procedures (run-time).

3 Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 3 ListBox Methods Additem: Adds an item to the listbox. ListName.AddItem string-value[, listindex] RemoveItem : Removes one item from the list box. ListName.RemoveItem (listindex) Clear : Removes all items from the listbox. ListName.Clear Method: Built-in procedure that can be called to perform an action to a particular object

4 Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 4 ListBox Properties List: Contains the string values displayed in the list. ListCount: The number of the list items. ListIndex: The index of the selected listbox item,Starts from 0. Sorted: True/False Specifies whether or not the list box items are sorted. Text: specifies the list box’s selected item.

5 Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 5 Multi-Selection ListBoxes To select more than one item from a list box, you can do so after handling some properties like style, multiselection. Style (Design-time): 0: Specifies a standard ListBox style (Default). 1: Specifies a ListBox with CheckBox in front of each item. How can you Select/Deselect from this ListBox? You can do so by pointing to the item ( using the mouse or up and down arrows), then choosing the item( Click the mouse or the spaces bar)

6 Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 6 Multiselect (Design-Time): 0 (None): Multiple selection not allowed. 1(Simple): Allows multiple selection. 2: (Extended): Allows multiple selection You can Selected/Deselected one or more items with the mouse or the space bar. Holding the Shift key and selecting an item selects all selections between the last selection and the current selection. Important Note: When Multiselect property > 0, Style property should be 0

7 Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 7 Selected (Run-Time): –True: The item is selected. –False: the item is deselected. Example: Print ListName.Selected(ListIndex) The result should be : True/False. Note: You can use this property in a loop to know what items are selected from the list.

8 Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 8 Lab5End


Download ppt "Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 Lab5 ListBox Control Properties, Methods and Events."

Similar presentations


Ads by Google