🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: query to Listbox

#4353
From: Gary Desroches
Date: Mon, 14 Jan 2002 02:59
29 lines
1995 bytes
You can use a for/next loop.
for( i = 0; i < ListLength; i++ )
{
// I'm assuming you have placed the cursor on the first item you need to
load.
ListBox1->Items->Add(MyQuery->FieldByName("FieldName")->Text);
MyQuery->Next();
}
This is only one way to do it in a loop. Rather than using FieldByName()
you can setup a DataSet which would allow you to use Fields->Field[x]:

Grid = Grid1->DataSource->DataSet;
ListBox1->Items->Add(Grid->Fields->Fields[i]->DisplayLabel);
// Adds the FieldLabels of the Grid to a list box where i = # of Columns in
grid




"JBird80" <jason.bird@att.net> wrote in message news:3c41c679_2@dnews...
> how would i load the items from a query into a dblistbox? i have been
> playing with it for a bit and cant seem to get it
> _________________________________________ Jason Bird ICQ#:146675360
Current
> ICQ status: SMS: (Send an SMS message to my ICQ): +2783142146675360 More
> ways to contact me: http://wwp.icq.com/146675360
> _________________________________________
>
>
Technical Details
Message-ID: <a1thqd$e68$1@nntp9.atl.mindspring.net>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed1.earthlink.net!newsfeed2.earthlink.net!newsfeed.earthlink.net!news.mindspring.net!not-for-mail
References: <3c41c679_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,62b2f38f6e128816
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2002-01-13 19:04:07 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed1.earthlink.net!newsfeed2.earthlink.net!newsfeed.earthlink.net!news.mindspring.net!not-for-mail
From: "Gary Desroches" <gcdesroches@mindspring.com>
Newsgroups: borland.public.cppbuilder.database.ado
Subject: Re: query to Listbox
Date: Sun, 13 Jan 2002 20:59:54 -0600
Organization: MindSpring Enterprises
Lines: 31
Message-ID: <a1thqd$e68$1@nntp9.atl.mindspring.net>
References: <3c41c679_2@dnews>
Reply-To: "Gary Desroches" <gcdesroches@mindspring.com>
NNTP-Posting-Host: d1.56.31.20
X-Server-Date: 14 Jan 2002 03:03:41 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200