Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ComboBox and Array 1

Status
Not open for further replies.

FoxLearner

Programmer
Aug 29, 2002
93
US
Hi
One of my combobox's rowsourcetype is 5(Array). It works fine, except that when clicked, the control is always at the last element of the array. How can I make it to show the first element of the array?
Thanks and regards
FoxLearner
 
FoxLearner

=ASORT() allows you to sort you array or:

Or set the FirstElement property in the combo.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Its interesting to see how everyone solves this problem.

I usually create my form arrays as a property and in my INTI code I set the value to the first item.

* assume the array has department of 10, 20, 30 and all. I want all to be at top.

THISFORM.laYears[1] = "All"

Of course, it could have been a value from a table/field as well.

****
Note: for those who are not aware of this, and believe me, it took me a while to find it because it's almost undocumented. Here is how you create a property as an array.

New Property
myarray[1] && make sure you include the size of one.

To declare it in the init or datasource.

Init.
DECL myarray[4]
myarray[1] = "All"
myarray[2] = "010"
myarray[3] = "020"
myarray[4] = "030"

or in the row source select.

SELECT dist departments from boo into arry thisform.myarray



Jim Osieczonek
Delta Business Group, LLC
 
Thanks all fo you. I tried THIS.ListIndex = 1 in the Init event, but it didn't work. I used in the Load event and it worked.
Thanks once again.
FoxLearner
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top