>I have a form containing 3 listboxes.
>
>These listboxes are populated by arrays (laBorders[n,2],laOperations[n,2] and laTerritories[n,2]) created with a SQL-SELECT statement in the form's INIT method.
>
>The arrays contain 2 elements - State Code and State Name.
>
>How do I pass a state code to the form, find that state code in one of the three arrays and have that state code & it's state name be the default when the form appears?
>
>I'm new to Visual FoxPro 3 and 5; so, any and all help would be greatly appreciated :)
>
>Dan Rhymes
First, you pass the state code to the form like any parameter:
DO FORM MyForm with 'StCode'
Next, put a parameter line in your INIT method
Parameter cStCode
Third, store this value to a form property, because it will only be visible in the INIT code and you will want to use it in other methods.
MyForm.StateCode = cStCode
Then, when you wish to check the arrays you can use ASCAN() with the form property and one or more of your arrays.
cStCode = MyForm.statecode
nFound = ascan(laborders, cStCode )
if nFound > 0
** do stuff
else
** do other stuff
endif
HTH
Barbara