Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to populate combo box with array
Message
 
 
To
01/05/2002 16:19:35
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00651529
Message ID:
00651588
Views:
17
Kahn,

I think your array is going out of scope. So you are losing all your hard work.

Assuming the array is a property of the form:

In the combo1.Init()
SELECT dist(compcode) FROM DBF() INTO ARRAY thisform.aCompCode
this.Requery()
the combo1 has these properties set at design time
RowSource = thisform.aCompCode
RowSourceType = 5 - Array
You can also make the array a property of the combo1 itself if you use a subclass of ComboBox. In which case you'd change to something like:
SELECT dist(compcode) FROM DBF() INTO ARRAY this.aList
this.Requery()
the combo1 has these properties set at design time
RowSource = this.aList
RowSourceType = 5 - Array
>But the code below gives me a blank combo box what's wrong ?
>
>
>DIMENSION aCompcode[1]
>SELECT dist(compcode) FROM DBF() INTO ARRAY aCompCode
>FOR each aCompcode in aCompcode
>	Thisform.combo1.AddItem(aCompcode)
>ENDFOR
>This.Requery
>
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform