Blank Item Appears in Dialog ListBox or ComboBox |
Q101552
A Microsoft WordBasic ListBox or ComboBox control may contain a blank selection if the array variable assignment does not begin at 0 (zero) or if the array variable is dimensioned with more elements than needed.
An array variable gives a single name to a group of related values and organizes them in a list or table.
Dim ArrayVariableName(LastElementNumber)The first element of a WordBasic array is always numbered 0 (zero). This means that the number of the last element is one less than the number of elements. For example:
Dim Months$(11) 'Define an array with 12 elements
Before you display a dialog box containing a list or combo box, you
must define an array and fill it with the items to be listed. For
example:
Sub Main
Dim FourWinds$(3) 'Define an array with 4 elements
FourWinds$(0) = "East"
FourWinds$(1) = "West"
FourWinds$(2) = "North"
FourWinds$(3) = "South"
Begin Dialog UserDialog 320, 144, "Microsoft Word"
OKButton 207, 92, 88, 21
CancelButton 207, 116, 88, 21
ListBox 21, 9, 169, 96, FourWinds$(), .Listbox1
End Dialog
Dim dlg As UserDialog
n = Dialog(dlg)
End Sub
If a value is not assigned to the first array element, FourWinds$(0),
a blank selection will appear at the top of the list box. If a blank
selection appears at the bottom of the list box, the number of array
elements is NOT one less than the total number of elements.
Dim FourWinds$(3) 'Define an array with 4 elements
"Using WordBasic," by WexTech Systems and Microsoft, page 80
Kbcategory: kbusage kbmacro
Additional query words: 6.0 2.0 word6 winword user defined editor listbox combobox winword2
Keywords : kbofficeprog
Issue type :
Technology :
|
Last Reviewed: March 28, 2000 © 2001 Microsoft Corporation. All rights reserved. Terms of Use. |