🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #777

Re: Records to the Combobox?

#777
From: Daryl
Date: Tue, 12 Apr 2005 21:20
53 lines
2621 bytes
Daryl wrote:
> Daryl wrote:
> 
>> James Peterson wrote:
>>
>>> ComboBox1->BeginUpdate();
>>> ComboBox1->Items->Add(ADOQuery1->Fields->Fields[0]->Value );
>>> ComboBox1->EndUpdate();
>>>
>>> this should work.
>>>
>>> "Guest" <Guest@aew_nospam.com> wrote in message
>>> news:41863815$1@newsgroups.borland.com...
>>>
>>>> Hi,
>>>>
>>>> This line adds only one row in combobox:
>>>> ComboBox1->Items->Add(ADOQuery1->Fields->Fields[0]->Value );
>>>>
>>>> How can add all records to the combobox?
>>>>
>>>> User submitted from AEWNET (http://www.aewnet.com/)
>>>
>>>
>>>
>>>
>>>
>> You may have to loop through the recordset generated by the ADOQuery
>> Example
>>
>> int pos = 0;
>> While (!ADOQuery1->Eof) {
>>   ComboBox1->Items->Add(ADOQuery1->Fields->Fields[0]->Value );
>>   pos++;
>>   ADOQuery1->Next();
>> }
> 
> Sorry
>  ComboBox1->Items->Add(ADOQuery1->Fields->Fields[0]->Value );  should be
>  ComboBox1->Items->Add(ADOQuery1->Fields->Fields[pos]->Value );
Actually answered this one too quickly, what I have provided may not be 
what you want.

If you are asking how to populate a TComboBox with a recordset with 
multiple field values therefore needing the TComboBox to have multiple 
columns then you need a different approach that what I have described.

Seeing << How can add all records to the combobox? >>  I immediately 
thought you wanted to add all the records, but only from one field, 
therefore one TComboBox column.

What I have given will do this only for the value in Field position 1. 
I this what you want?
Technical Details
Message-ID: <425c3bf0$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <41863815$1@newsgroups.borland.com> <4256b3d7$1@newsgroups.borland.com> <425c391d$1@newsgroups.borland.com> <425c39a4$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,17ab27b9c4e85127
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Wed, 13 Apr 2005 07:20:02 +1000
From: Daryl <developeracc@hotmail.com>
User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.database.ado
Subject: Re: Records to the Combobox?
References: <41863815$1@newsgroups.borland.com> <4256b3d7$1@newsgroups.borland.com> <425c391d$1@newsgroups.borland.com> <425c39a4$1@newsgroups.borland.com>
In-Reply-To: <425c39a4$1@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 203.103.112.241
Message-ID: <425c3bf0$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1113340912 203.103.112.241 (12 Apr 2005 14:21:52 -0800)
Lines: 53
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail