DlgListBoxArray Instruction/Function
Syntax
DlgListBoxArray DlgItem, StrArray$( )
-or-
DlgListBoxArray(DlgItem[, StrArray$( )])
Group
Description
Instruction: Set the list entries for DlgItem.
Function: Return the number entries in DlgItem's list.
This instruction/function must be called directly or indirectly from a dialogfunc. The DlgItem should refer to a ComboBox, DropListBox, ListBox or MultiListBox.
Parameters |
Description |
If this is a numeric value then it is the dialog item number. The first item is 0, second is 1, etc. If this is a string value then it is the dialog item's field name. |
|
Set the list entries of DlgItem. This one-dimensional array of strings establishes the list of choices. All the non-null elements of the array are used. |
Example
Dim lists$()
Sub Main
ReDim lists$(0)
lists$(0) = "List 0"
Begin Dialog UserDialog 200,119,.DialogFunc
Text 10,7,180,14,"Please push the OK button"
ListBox 10,21,180,63,lists(),.list
OKButton 30,91,40,21
PushButton 110,91,60,21,"&Change"
End Dialog
Dim dlg As UserDialog
dlg.list = 2
Dialog dlg ' show dialog (wait for ok)
Debug.Print dlg.list
End Sub
Function DialogFunc(DlgItem$, Action%, SuppValue?) As Boolean
Select Case Action%
Case 2 ' Value changing or button pressed
If DlgItem$ = "Change" Then
Dim N As Integer
N = UBound(lists$)+1
ReDim Preserve lists$(N)
lists$(N) = "List " & N
DlgListBoxArray "list",lists$()
DialogFunc = True 'do not exit the dialog
End If
End Select
End Function