?
Solved

CheckListBox

Posted on 2001-07-09
4
Medium Priority
?
377 Views
Last Modified: 2010-04-06
How can i add my records from database to CheckListBox component?
0
Comment
Question by:mohbb22
3 Comments
 
LVL 5

Accepted Solution

by:
TheNeil earned 400 total points
ID: 6265750
Iterate through the data.

CheckListBox1.Items.Clear;
Data.First;
WHILE NOT(Data.EOF)
DO
BEGIN
  CheckListBox1.Items.Add(Data.FieldByName(<Field Name).AsString);
  Data.Next;
END;

Obviously you'll have to change Data to be your data object and insert a field name into the Items.Add statement but the idea is the right one

The Neil =:)
0
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6266602
Hell

this code will add the field company from customer table to the checklistbox
var
  I : integer;
begin
  for I := 0 to Table1.RecordCount -1  do
  begin
    CheckListBox1.Items.Add(Table1['company']);
    Table1.Next;
  end;

and if u want u can  add more fields in the same item :

  CheckListBox1.Items.Add('CustNo= ' + IntToStr(Table1['CustNo']) + ', Company= ' + Table1['company']);

Best regards
Mohammed Mohammed
0
 
LVL 26

Expert Comment

by:Russell Libby
ID: 8702679
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

To accept TheNeil's comment as answer

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Thank you,
Russell

EE Cleanup Volunteer
0

Featured Post

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.

Question has a verified solution.

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

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…
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…
Screencast - Getting to Know the Pipeline
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month15 days, 7 hours left to enroll

840 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