DtoSelectionItems Collection
A collection of DtoSelectionItem objects representing the possible values of a selection type setting.
Properties
Count | Returns the number of members in a collection. |
Item | Returns a specific member of a collection. |
Methods
Remarks
The property
AllPossibleSelections of object
DtoSetting Object returns the
DtoSelectionItems collection.
Use the Count property to find the number of members in the collection.
Example
Set first_setting = my_settings(1)
type = first_setting.Type
if (type = dtoSingleSel) OR (type = dtoMultiSel)
Set all_the_selections = first_setting.AllPossibleSelections
See Also
Methods Detail
Add method
Add an item to a DtoSelectionItems collection.
Syntax
result = Collection.Add(Object)
Arguments
Collection | DtoSelectionItems Collection to which to add object. |
Object | A DtoSelectionItem object that you want to add. |
Return Values
result | DtoResult long value indicating the result of the method call. Use the Error property of the
DtoSession Object to obtain a description for the result. |
Remarks
This method takes a parameter of type DtoSelectionItem. Therefore, you are responsible for first instantiating the object and setting its properties before adding it to the collection.
Example
Dim Result As dtoResult
Dim Session As New DtoSession
Result = Session.Connect("nik-ntws", "", "")
Dim my_setting As DtoSetting
Dim SetID As Long
SetID = 26
Set my_setting = Session.GetSetting(SetID)
If my_setting Is Nothing Then
MsgBox " Setting is wrong"
Exit Sub
End If
new_selections.Add my_setting.AllPossibleSelections.Item(2)
new_selections.Add my_setting.AllPossibleSelections.Item(4)
new_selections.Add my_setting.AllPossibleSelections.Item(12)
my_setting.Value = new_selections
GetById method
Returns a DtoSelectionItem object from a DtoSelectionItems collection given an id.
Syntax
my_selection_item = Collection.GetById(id)
Arguments
Collection | DtoSelectionItems collection |
id | The id of the item you wish to retrieve from the collection. The id for a particular selection item can be obtained with the ItemId property of the DtoSelectionItem object. |
Return Values
Example
Dim Result As DtoResult
Dim Session As New DtoSession
Result = Session.Connect("nik-ntws", "", "")
Dim my_setting As DtoSetting
Dim SetID As Long
SetID = 26
Set my_setting = Session.GetSetting(SetID)
If my_setting Is Nothing Then
MsgBox " Setting is wrong"
Exit Sub
End If
Dim new_selections As New DtoSelectionItems
new_selections.Add my_setting.AllPossibleSelections.GetByID(1)
new_selections.Add my_setting.AllPossibleSelections.GetByID(3)
new_selections.Add my_setting.AllPossibleSelections.GetByID(11)
my_setting.Value = new_selections
Remove method
Removes an item from a DtoSelectionItems collection
Syntax
result = Collection.Remove(item)
Arguments
Collection | DtoSelectionItems collection |
item | Variant that can contain the index (starting with 1) of the item you wish to remove from the collection or the name of the selection item. |
Return Values
result | DtoResult long value indicating the result of the method call. Use the Error property of the
DtoSession Object to obtain a description for the result. |
Remarks
This method takes a parameter of type DtoSelectionItem
Example
Dim Result As DtoResult
Dim Session As New DtoSession
Result = Session.Connect("nik-ntws", "", "")
Dim my_setting As DtoSetting
Dim SetID As Long
SetID = 26
Set my_setting = Session.GetSetting(SetID)
If my_setting Is Nothing Then
MsgBox " Setting is wrong"
Exit Sub
End If
Dim new_selections As New DtoSelectionItems
new_selections.Add my_setting.AllPossibleSelections.GetByID(1)
new_selections.Remove(1)
my_setting.Value = new_selections