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!

Showing array in listbox

Status
Not open for further replies.

Bryan - Gendev

Programmer
Jan 9, 2011
408
AU
To run specific SQL queries I have created an array and populated it with :-


n.1 query description
n.2 SQL query

My first listbox on the form is a lookup for all field names. Normally hidden

My second listbox is the operational one and shows the n.1 entries.

Having the user select a line in listbox2 I want to use the string in the second cell to run the SQL query.


How do I show the second cell str in my SQL editbox please?

In other words how do I find the line in the underlying array so that I can I find indexnum to use this in the click() method

thisform.text1.Value = gaMyListArray2[indexnum,2]

Thanks

GenDev
 
Huh?

If you're displaying an array in a list and the user chooses the 3rd row, you're looking for array(3,2) from my reading.

I have no idea where a field list or an editbox come into this.
 
Dan,

A picture of my form would have been useful - however ....

I'm displaying the 'english' description of the query in a listbox from the array and want to pass the 'actual' query details from the list to an edit box on my form.

But how do I find the selected row number from the list? I'm sure its simple I just can't nut it out at present.

Regards

GenDev
 
Duh! I've now found listindex using the debugger - wish I'd thought of looking before - sorry to waste everyone's time.

GenDev
 
In case of a single select listbox the easier way is to set the listbox rowsourctype 6 (fields) and the rowsource to aliasname.description (only that field containing the english query description).

Then the selected row of the listbox is the active row of the alias and so aliasname.sqlquery is the query.

You can set an editbox controlsource to aliasname.sqlquery and then this will automatically show the selected query without any code.

Remmber, in VFP aliases, cursors, are the main thing to use, not arrays.

Bye, Olaf.
 
Duh! I've now found listindex using the debugger - wish I'd thought of looking before - sorry to waste everyone's time.

Oh! Sorry! It wouldn't have occurred to me you didn't already know that, but from the timestamps it looks like it didn't take you long to find it.

Happy to ... umm ... help. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top