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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo Box in a grid 2

Status
Not open for further replies.

audiopro

Programmer
Apr 1, 2004
3,165
GB
I have a combo box, in a grid which is populated from an array.
The array is dimensioned in the INIT method of the combo box ( I have also tried it in the LOAD method of the form).
Sometimes the dropdown shows the list of contents and sometimes it is empty.
I know this is a bit vague but is this something anyone else has encountered?

Keith
 
Using an array as record/rowsource has the prerequisite of the array being in scope.
DIMENSION creates a local var, that is gone after the init event, or load event, or whatever other method, unless you make the array a property of an object, eg of the combobox itself.

That is still the same reason we discussed already in thread184-1719642

Bye, Olaf.
 
If I make the array a property, where do I assign the values?

In the same place as you ae doing it now: in the Init of the combo.

You need to add a custom array property to the combo at design time. To do so, just place a number - any number - in square brackets after the property name. So, if your array property is called aMyArray, you type [tt]aMyArray[1][/tt] in the New Property box.

Then, in the combo's Init, you place the values in the array, which you refer to as [tt]THIS.MyArray[/tt]. As far as I know, you don't need a DIMENSION statement for it.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
If you query INTO ARRAY, you use ACOPY to copy the result array to an array property. You can create an array property at design or runtime, as you like, filling it with data in the combo init is a good time.

Don't forget you set the rowsource = "arrayname" not rowsource = arrayname, because that would take the value of arrayname[1,1] as rowsource.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top