Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Combobox with no entries
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00494738
Message ID:
00494772
Views:
14
>I have a combobox class which uses an array ROWSOURCE. The way my code currently works, the array is populated via a SQL SELECT statement. If no records are retrieved by the SQL, the array has 1 row, with all elements being .F. Conceptually, this is a zero-row array, and therefore a zero-option combobox.
>
>Is there any way to make the combobox NOT drop down in this situation? I tried putting the following code in the DROPDOWN() event:
IF VARTYPE(MyArray[1]) = "F"
>   NODEFAULT
>ENDIF
but to no avail.

One suggestion here - the type will be 'L' not 'F' (the variable type is a Logical).

The obvious solution is to not use an array at all - if you used a cursor rather than an array, you'd end up with a cursor with a RECCOUNT() of 0; you avoid all the headaches associated with an array, including the scoping issues, the limit on the number of elements, etc.) And the data type and value widths will always be a consistent value, unlike the array.

>
>If I can't suppress the drop down, I can instead populate that one row with dummy values -- but then I have to make all of my code handle the possibility that the user has selected the "dummy" row.
>
>Am I missing the obvious solution here?
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform