Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Listbox reporting improper Listcount.
Message
From
01/11/2005 14:58:41
 
 
To
01/11/2005 12:23:06
Diran Nazarian
Alion Science and Technology
Annapolis, Maryland, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows 2000 SP4
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01062256
Message ID:
01064156
Views:
21
>The control source of the listbox is an Evalution of an expression. (ex. EVALUATE(lc_expression)) I then have the property rowsourcetype = to 6 (fields) and the rowsource is equal to the expression, which is comprised of fields from the table that contains data.
>
>So an example of my form's load is the following
>
>lc_expression = 'table.field1 + ":" + table.field2'
>
>lc_listdata = EVALUATE(lc_expression)
>
>
>Listbox properties:
>
>ControlSource = lc_listdata
>
>Rowsourcetype = 6 ('Fields')
>
>Rowsource = lc_expression


I'm still having a hard time seeing what the ControlSource is at runtime. However, it looks like both RowSource and ControlSource point to the same table. If that's the case, you're definitely going to run into problems.

>
>Another thing to keep in mind is I have a fiter set to the table. This is done so that I retrieve only the data I want from the table into the list. I believe it's the filter that is causing all this headache.
>

A much cleaner solution is to set RowSourceType to 2-Alias and then use a query to populate a cursor with the rows and fields you want to show. It avoids the filter issue, and keeps the list you're looking at to the minimum number of records, which should improve performance. In this situation, I like to put the query into the Requery method if the list will change in the list of the listbox.

>Having all of these the list just doesn't seem to behave properly and I can't figure out why it would have any effect on its listcount.

I don't know either, so the easiest thing is to just clean it up and see if the problem goes away.

Tamar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform