Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
List box does not refresh in VFP 9
Message
From
20/09/2006 10:25:56
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
List box does not refresh in VFP 9
Miscellaneous
Thread ID:
01155542
Message ID:
01155542
Views:
381
I created a simple form with a combo box (cboCustomer) and a list box (lstOrders). The combo box is used to select a customer ID from a customer table, and its valid event is used to load the orders for the selected customer from the Orders table. Here are the properties for cboCustomer and lstOrders. (The Customer and Orders table have been added to the Data Environment of the form. Data Session is default.)
* Define properties for the cboCustomer combo box
WITH Thisform.cboCustomer
    .ColumnCount   = 2
    .ColumnWidths  = "200,0"
    .ColumnLines = .F.
    .BoundColumn = 2
    .RowSourceType = 3         && SQL Statement
    .RowSource = "select company, cust_id from customer into cursor curCustomer"
    .Style = 2                 && Dropdown list
ENDWITH

* Define Properties for the lstOrders list box
WITH Thisform.lstOrders
    .RowSourceType = 2        && Alias
    .ColumnCount   = 4
    .ColumnWidths  = "100,100,100,100"
ENDWITH 
The Valid() event of cboCustomer has the following code
Thisform.lstOrders.RowSource = ''
SELECT order_id,order_date, order_amt, shipped_on FROM orders ;
    WHERE cust_id = This.value ;
    INTO CURSOR curSelectedOrders ;
    ORDER BY order_id
Thisform.lstOrders.RowSource = 'curSelectedOrders'
The form runs fine in VFP 8. As soon as I select a new customer, the list box displays the orders for that customer in the list box. However, when I ran the same form in VFP 9 on some other computer, I see strange behaviour, e.g. list box disappears, list box does not refresh, list box appears when I click on the disappeared list box, etc. I added code to refresh the list box and/or the form, but it did not help.

I did another experiment-- I changed the lstOrders.RowSourceType to 3 (SQL Statement) and the form refreshes fine in VFP 8 as well as VFP 9 without any problem (after lstOrders.Requery())

Any comments or suggestions?
- Ravi Taxali
Visual FoxPro Made Simple An excellent book for beginners as well as experienced programmers
Never Forget Again. Setup Email Reminders.
Next
Reply
Map
View

Click here to load this message in the networking platform