Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Right way with combo box control?
Message
From
05/06/2008 10:19:04
 
 
To
05/06/2008 08:27:13
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01320984
Message ID:
01321862
Views:
23
Hi Tamar,

- the combo's row source is an array that is a property of the combo
- it's bound to a field in a cursor with the binding happening on Col 2 of the array (Col 1 is the display name)
- the array is not filled in until the form's .Init() code because I have to wait until then to get a parameter that then determines the array contents
- after populating the array, I issue .Requery() to bring the rows into the combo and then .Refresh() to get the display up to date; I had assumed the .Refresh() would have reset both .ListIndex and .ListItemID

- in this case, if I start up the form with the bound field at it's default (zero), since there is no corresponding entry in the array with that value, I would have assumed that .ListItemID would have been -1 and .ListIndex = 0; ListIndex is correct but ListItemID is a 1; the display is correct i.e. a blank row shows and if you click the down arrow on the control, it shows that no row has been chosen yet.

- I was getting incorrect results because .ListItemID was incorrect; the code now checkes both .ListItemID and .ListIndex and both have to be greater than zero - but that's only to handle the problem, should not really have to do that.

Thanks,
Albert

>
>Remind me. You're set ControlSource to the relevant field? Refreshed the combo?
>
>Tamar
Previous
Reply
Map
View

Click here to load this message in the networking platform