Form.AddListBox
The AddListBox function allows the script to add a list box to the Form.
Syntax |
Form.AddListBox(X, Y, Rows, Columns, pStrings) |
Description |
Adds a list box to a Form. |
Arguments |
X {integer} Represents the horizontal position of the list box on the Form—the position on the 'X-Axis'.
Y {integer} Represents the vertical position of the list box on the Form—the position on the 'Y-Axis'.
Rows {integer} Defines the number of rows in the list.
Columns {integer} Defines the number of columns in the list (this is optional).
pStrings {string array} Represents the options that are shown in the list box. |
Returns |
List Box Control Object List box Control Objects have common Control Object Properties as well as their own specific functions and properties that can be used in the script—see List Box Functions and see List Box Properties. |
Example:
The following script creates a Form that has a list box with 3 options (named Temperature, Pressure, and Humidity respectively):
- Public Sub ListExample
- Dim pStrings (2)
- Dim frmCombo
- pStrings(0) = "Temperature"
- pStrings(1) = "Pressure"
- pStrings(2) = "Humidity"
- Form.Init ("ListBox")
- Set frmCombo = Form.AddListBox(2,2,10,2,pStrings)
- Form.Show
- End Sub
The pStrings array is declared as a variable, with each of its options also defined before the Form.Init function.
The Form.AddListBox function then has the arguments of 2, 2 for the positioning of the list box, 10 for the number of rows, 1 for the number of columns, and pStrings is a reference to the pStrings variable (which is the string array).