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

Help with List boxes 1

Status
Not open for further replies.

obliviux

Programmer
Jun 2, 2000
38
US
I am trying to display all the fields in a table to a list box.&nbsp;&nbsp;I am using the query designer and am binding it to the list box.&nbsp;&nbsp;<br><br>The problem is that I can get only one field to be displayed at a time.<br><br><br>Jeremy
 
At what point is the query being bound to the list box (what event)?<br>You may need to do a Listbox.Requery() immediately after you bind the query to the listbox.<br><br>FWIW, this is how I would achieve what you are doing.<br><br>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.<br><br>Set the listbox's RowSourceType property to 5-Array and the RowSource to 'Thisform.aBound'.<br><br>Populate the array with the fields from the table(your case probably calls for this in the form load event):<br>Afields(Thisform.aBound)<br><br>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. <p>Jon Hawkins<br><a href=mailto: > </a><br><a href= > </a><br>Carpe Diem! - Seize the Day!
 
How about a much easier way:<br><br>Forget about the array and just set the list box's RowSourceType to 6 - Fields. <p>Robert Bradley<br><a href=mailto: > </a><br><a href= - Visual FoxPro Development</a><br>
 
DOH!!<br><br>I thought he was trying to populate the listbox with the field names, not the values.<br><br>My mistake. <p>Jon Hawkins<br><a href=mailto: > </a><br><a href= > </a><br>Carpe Diem! - Seize the Day!
 
No, you are right, Jon; my mistake.<br><br>I should have said: change RowSourceType to:<br><font color=red>8 - Structure</font> <p>Robert Bradley<br><a href=mailto: > </a><br><a href= - Visual FoxPro Development</a><br>
 
Is there only 1 column in your list's ColumnCount property?&nbsp;&nbsp;Don't forget the builders for base VFP controls.&nbsp;&nbsp;They can be helpful <p>John Durbin<br><a href=mailto: john@johndurbin.com> john@johndurbin.com</a><br><a href= </a><br>ICQ #9466492<br>
ICQ VFP ActiveList #73897253
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top