Solved

List Box failure

Posted on 2000-05-10
6
183 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

690 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