Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Populating listboxes with values
Message
From
21/05/1998 11:15:30
 
 
To
21/05/1998 00:46:19
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00100714
Message ID:
00100835
Views:
33
Hello Bob,

Why don't you use a different rowsourcetype and try populating your lisbox rowsource using select-sql. It is a lot more efficient, i. e;
*-- myListBox.Init()
PUBLIC gaRowSource
WITH this
   *-- Assign the rowsource -- you can do this in the PEM manager rather than
   *   in code.
   .rowsource = "gaRowSource"
   *-- Rowsource type is array.  It could also be cursor -- but I think array is
   *   easier to work with.  You will get lots of other opinions.
   .rowsourcetype = 5
   *-- Select just the SSN and last fields from my .dbf table into the array
   SELECT SSNField, LastField from myRowSourceTable INTO ARRAY gaRowSource
   *-- If something was select, ok.  If nothing was selected there is a problem
   *   so display a MESSAGEBOX() (omitted here) to alert the user.
   IF _TALLY > 0
      *-- Requery to reinstall gaRowSource as the .rowsource for this control
      *   This is the same as reassigning the rowsource with: 
      *   .rowsource ="gaRowSource"
      .requery()
   ELSE
      *-- error message here
   ENDIF
ENDWITH
RETURN
In actual code I would probably make aRowSource a property of the listbox -- in fact all of my combobox and listbox abstract classes include an aRowSource[1] property just in case I want to populate the rowsource from an array.

To display both columns of the rowsource, be sure to your .columncount property to 2 so both columns display.

Regards,

JME
Jim Edgar
Jurix Data Corporation
jmedgar@yahoo.com

No trees were destroyed in sending this message. However, a large number of electrons were diverted from their ordinary activities and terribly inconvenienced.
Previous
Reply
Map
View

Click here to load this message in the networking platform