Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Help with List boxes

Help with List boxes

Help with List boxes

I am trying to display all the fields in a table to a list box.  I am using the query designer and am binding it to the list box.  

The problem is that I can get only one field to be displayed at a time.


RE: Help with List boxes

At what point is the query being bound to the list box (what event)?
You may need to do a Listbox.Requery() immediately after you bind the query to the listbox.

FWIW, this is how I would achieve what you are doing.

Create an array property(If this listbox is a subclass, create the property on it, else create the property on the form). I'll assume the array is a property of the form for this example.

Set the listbox's RowSourceType property to 5-Array and the RowSource to 'Thisform.aBound'.

Populate the array with the fields from the table(your case probably calls for this in the form load event):

FYI, although Thisform.aBound() consists of 16 columns, as long as your listbox is set to 1 column, you will only get the column names. If you want to provide more detail about the fields to the user, change your listbox's columncount and columnwidths properties to allow for the extra data.

Jon Hawkins

Carpe Diem! - Seize the Day!

RE: Help with List boxes

How about a much easier way:

Forget about the array and just set the list box's RowSourceType to 6 - Fields.

Robert Bradley

FoxDev - Visual FoxPro Development

RE: Help with List boxes


I thought he was trying to populate the listbox with the field names, not the values.

My mistake.

Jon Hawkins

Carpe Diem! - Seize the Day!

RE: Help with List boxes

Is there only 1 column in your list's ColumnCount property?  Don't forget the builders for base VFP controls.  They can be helpful

John Durbin

ICQ #9466492
ICQ VFP ActiveList #73897253

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close