Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

List Box failure

Posted on 2000-05-10
6
Medium Priority
?
192 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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 400 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

610 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