Blank Item Appears in Dialog ListBox or ComboBox

Last reviewed: July 30, 1997
Article ID: Q101552
The information in this article applies to:
  • Microsoft Word for Windows, versions 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c, 6.0, 6.0a, 6.0c

SUMMARY

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.

MORE INFORMATION

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

REFERENCES

"Using WordBasic," by WexTech Systems and Microsoft, page 80

Kbcategory: kbusage kbmacro KBSubcategory:


Additional query words: 6.0 2.0 2.0a 2.0a-CD 2.0b 2.0c word6
winword user defined editor listbox combobox winword2
Version : 2.0 2.0a 2.0a-CD 2.0b 2.0c
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 30, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.