Solved

Problems with TComboBox !!!!

Posted on 2001-07-12
8
222 Views
Last Modified: 2010-04-06
How can I load on the TComboBox component one colum of a TDBGrid (I load one Table1) that I create from a DataBase (Access 97).
I only could load the first line of my Table1 with this:

cant := Form1.Table1.RecordCount;
  for  i := 0 to cant do
    Form3.List.Items.Insert(i, Form1.Table1);

I need to load each line of one colum.  Thanks.
0
Comment
Question by:matuf
8 Comments
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6277226
Hello

  change ur code as following ,you are adding only the first record, so you need to move to the next one


cant := Form1.Table1.RecordCount -1;
 for  i := 0 to cant do
  begin
   Form3.List.Items.Insert(i, Form1.Table1);
   Form1.Table1.Next;
  end



0
 
LVL 9

Expert Comment

by:ITugay
ID: 6277232
Hi matuf,

something like this:

Table1.DisableControls;
Table1.First;
while not Table1.EOF do
begin
  ListBox1.Items.Add(Table1.Fields[3].AsString);
  Table1.Next;
end;
Table1.EnableControls;

0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 50 total points
ID: 6277252
recordcount is not allways properly set,
depending on the database

better would be
table1.first;
while not table1.eof do
begin
  Form3.List.Items.add(table1.fieldbyname('fieldwhateverneeded').asstring;
  table1.next;
end;

meikl ;-)
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 9

Expert Comment

by:ITugay
ID: 6277277
:-)
0
 

Author Comment

by:matuf
ID: 6277301
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6277422
hu,
igor didn't see your comment before now,
sorry to get a grade, which should you have get

but anyway

matuf, thanks for the points :-)
glad to be of service
good luck again

meikl ;-)
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6277425
igor, its only a c-grade :-(
0
 
LVL 9

Expert Comment

by:ITugay
ID: 6277457
really? I miss nothing :-)
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

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…
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 Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

776 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