Syntax 2: For PictureListBox, DropDownPictureListBox, and
RibbonComboBoxItem controls
Description
Adds a new item to the list of values in a picture list
box.
Applies to
PictureListBox, DropDownPictureListBox, and RibbonComboBoxItem
controls
Syntax
|
1 |
listboxname.AddItem ( item {, pictureindex } ) |
|
Argument |
Description |
|---|---|
|
listboxname |
The name of the PictureListBox or DropDownPictureListBox |
|
item |
A string whose value is the text of the item you want to |
|
pictureindex (optional) |
An integer specifying the index of the picture you want |
Return value
Integer.
Returns the position of the new item. If the list is sorted, the
position returned is the position of the item after the list is sorted.
Returns -1 if it fails. If any argument’s value is null, AddItem returns
null.
Usage
If you do not specify a picture index, the newly added item will
not have a picture.
If you specify a picture index that does not exist, that number is
still stored with the picture. If you add pictures to the picture array
so that the index becomes valid, the item will then show the
corresponding picture.
For additional notes about items in list boxes, see Syntax
1.
Example 1
This example adds the item Cardinal to the PictureListBox
plb_birds:
|
1 2 3 4 5 6 |
integer li_pic, li_position string ls_name, ls_pic li_pic = plb_birds.AddPicture("c:picscardinal.bmp") ls_name = "Cardinal" li_position = plb_birds.AddItem(ls_name, li_pic) |
If plb_birds contains Robin and Swallow and the Sorted property is
false, the AddItem function above returns 3 because Cardinal becomes the
third and last item. If the Sorted property is true, AddItem returns 1
because Cardinal is first when the list is sorted alphabetically.
Example 2
This example adds two items to the ribbon combo box:
|
1 2 3 4 5 6 |
Integer li_Return RibbonComboBoxItem lr_ComboBox li_Return = lr_ComboBox.SetBoxPictureList("PaperSizeA0Small!,PaperSizeA1Small!") li_Return = lr_ComboBox.AddItem("Item1") li_Return = lr_ComboBox.AddItem("Item2",1) |
See also