🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: How to select by code all records in a DBGrid?

#3047
From: Dan Greer
Date: Sat, 04 Jan 2003 00:42
66 lines
2900 bytes
You could try the "MoveBy(x)" method of your dataset.

if will move the position forward or backward and from you current position.

Example:

Query1->First();            //    Set to the first record
Query1->MoveBy(5);    //   move to the 5th record (row)
Query1->MoveBy(-1);  //    moves to the 4th record (row)
Query1->MoveBy(6);    // moves to the 10th record (row)

It look confusing, but with some work you could make it easier.

dang


"Alen Markov" <NOSPAM_amarkov@gmx.net> wrote in message
news:3e15e83a$1@newsgroups.borland.com...
> I'm still "fighting" with that DBGrid:
>
> I need to copy the content of one column of the DBGrid to a combobx
>
> 1.)
> Let's say I have a DGBrid with a few rows displayed.
> I can select a few rows by mouse and then I know how to copy the
> SELECTED rows (of a particular column) to the combobox.
> (an example can be easily found in the Builders helpfile...)
>
> But thist must happen at programstart (Event OnShow from the form),
> means I need somehow to select all the rows in the DBGrid automatically.
>
> How to select all records in a DBGrid by programmcode?
>
>
> 2.)
> Another approach how to fill the combobox with rows displayed in a column
> of a DBGrid would be, If I would know how to access for example
> in column number 0 the row number 3...
>
> I've found out that I can access column number 0, row number 0
> for example like this:
>
> void __fastcall TForm1::Button2Click(TObject *Sender)
> {
>    Label1->Caption = DBGrid1->Columns->Items[0]->Field->AsString;
> }
>
> But how to access rows number 1, 2, 3 and so on...?
>
>
>
>
> Any hint would be greatly appreciated...
>
>
> Thanks  a lot in advance and best regards
>
> Alen
>
>
>
>
> --
> WEB: http://www.come.to/nostromo
>
>
Technical Details
Message-ID: <3e162daa$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newsfeed.gamma.ru!Gamma.RU!opentransit.net!news-out.cwix.com!newsfeed.cwix.com!iad-peer.news.verio.net!news.verio.net!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!newsgroups.borland.com!not-for-mail
References: <3e15e83a$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,13f65491e8885df5
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2003-01-03 16:46:36 PST
Reply-To: "Dan Greer" <info@pmicp.com>
From: "Dan Greer" <info@pmicp.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3e15e83a$1@newsgroups.borland.com>
Subject: Re: How to select by code all records in a DBGrid?
Date: Fri, 3 Jan 2003 16:42:08 -0800
Lines: 70
Organization: PMICP
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 63.196.117.222
Message-ID: <3e162daa$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1041640874 63.196.117.222 (3 Jan 2003 16:41:14 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newsfeed.gamma.ru!Gamma.RU!opentransit.net!news-out.cwix.com!newsfeed.cwix.com!iad-peer.news.verio.net!news.verio.net!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!newsgroups.borland.com!not-for-mail