Solved

List Box failure

Posted on 2000-05-10
6
173 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sending Gmail through Delphi 3 91
how to center only a line in richedit? 4 52
Downloading email attachments 2 67
Reconfigure Delphi Install? 2 47
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…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

863 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

23 Experts available now in Live!

Get 1:1 Help Now