DOCERR: ListIndex (OutLine) Returns -1 If No Item Is SelectedID: Q148998 3.00 3.00b WINDOWS kbtool kbdocerr The information in this article applies to:
SUMMARYVisual FoxPro Help says that the return value for the ListIndex (OutLine Control) Property is 0 if no item is selected. This is incorrect. The value returned if no item is selected is -1. It also says that the first index number that the ListIndex property can return is 1, which is also incorrect. The first index number that can be returned is 0.
MORE INFORMATIONThe OutLine control is contained in the Msoutl32.ocx file located in the Windows\System subdirectory. Because .ocx files are written in the C language, the arrays they use start at zero. Therefore, the array that holds the values in the OutLine control that the ListIndex property references starts at zero. This referencing is different from the ListIndex property for a combo or list box where 0 is returned if no item is selected. This occurs because arrays in FoxPro start at 1.
Steps to Illustrate Behavior1. Create a new form, and add a OLE Container control by moving it from the 2. When the Insert Object dialog box appears, click Insert Control, and
3. Add the following code to the Init event of the OutLine Control:
4. Place a text box on the form. In the ControlSource property, type:
5. In the Click event of the OutLine control, place the following code:
6. Run the form. Note that the text box displays -1. After you click the
Additional reference words: 3.00 3.00b VFoxWin
KBCategory: kbtool kbdocerr
KBSubcategory: FxtoolFormdes
|
Last Reviewed: November 25, 1997 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |