Solved

List Box failure

Posted on 2000-05-10
6
172 Views
Last Modified: 2010-04-04
I am creating a form with various DB compnents. All grids, combo boxes seem to work except a list box I am tring to generate. I can insert assign it data and fields but it simply will not display the data. What is going on?
0
Comment
Question by:jblangworthy
6 Comments
 

Expert Comment

by:skyrider_tieus
ID: 2798297
Can you be more specific?
0
 
LVL 2

Expert Comment

by:NetoMan
ID: 2798360
listening...
0
 
LVL 15

Expert Comment

by:simonet
ID: 2798518
Are you sure it's a TDBListBox (the data-aware version) ?

Are you linking it correctly to the datasource and setting the field name accordingly?

If the datasource's dataset active (is table or query open) ?

Alex
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 9

Expert Comment

by:ITugay
ID: 2799340
listening...
0
 

Author Comment

by:jblangworthy
ID: 2802585
Yes, it is a DBListBox. I have sorted the problem now anyway, thanks. I didn't realise I had to add the items to the list-box. I thought it would fill them in itself, like access does.
0
 
LVL 15

Accepted Solution

by:
simonet earned 200 total points
ID: 2925917
>I thought it would fill them in itself, like access does.

You can do that automatically in runtime, based on the existing different items in the table.

Suppose the TDBListBox is linked to the field DESCRIPTION of TABLE1, and you want all existing "descriptions" to be displayed at the dblistbox.

This will do it for you:
(you'll need a TQuery [Query1] component)

procedure FillDBListBox;
begin
  with Query1, DBListBox1 do
  begin  
    items.beginupdate;
    items.clear;
    close;
    sql.text := 'SELECT DISTINCT DESCRIPTION FROM TABLE1 ORDER BY DESCRIPTION';
    open;
    first;
    while not eof do
    begin
       items.add(fieldbyname('description').asstring;
       next;
    end;
    items.endupdate;
  end;
end;

Yours,

Alex
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
APK file name 7 63
Delphi OLE Error 8 83
Copy file in dll not working but working on exe ! 18 83
Newbie Thread Programming 1 116
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now