Article View: borland.public.cppbuilder.database.ado
Article #5984Re: Iterating through data aware controls
From: Robin Marlowe
Date: Mon, 11 Dec 2000 20:10
Date: Mon, 11 Dec 2000 20:10
35 lines
1829 bytes
1829 bytes
"Ian Searle" <iansearle@lightningit.co.uk> wrote in message
news:3a2d6336_2@dnews...
> Hi
>
> Sorry....re my post, the other question is that in a form where there are
a
> number of buttons, a progress bar and Database edit controls, is there a
way
> of iterating through only the data aware components to change their data
> source properties at runtime in response to, say, the user clicking on a
> button.
>
> Thanks
>
Well, you COULD iterate through the components the parent owns, and test
cast them e.g.
for (int i=0; i<ComponentCount; i++) {
TDBGrid *d = dynamic_cast< TDBGrid* >(Components[i]);
TDBEdit *e = dynamic_cast< TDBEdit* >(Components[i]);
if (d) d->DataSource = DataSource2;
else if (e) e->DataSource = DataSource2;
}
But isn't it simpler to just to access all the components by name?
DBGrid1->DataSource = DataSource2;
DBEdit1->DataSource = DataSource2;
Robin
Technical Details
Message-ID:
<913c23$9bd5@bornews.inprise.com>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-xit-03!supernews.com!xfer13.netnews.com!netnews.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!bornews.borland.com!not-for-mailReferences:
<3a2d6283_1@dnews> <3a2d6336_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,9d4b096290964316 X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2000-12-11 12:10:37 PST Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-xit-03!supernews.com!xfer13.netnews.com!netnews.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!bornews.borland.com!not-for-mail From: "Robin Marlowe" <robin.marlowe@zepler.org> Newsgroups: borland.public.cppbuilder.database.ado Subject: Re: Iterating through data aware controls Date: Mon, 11 Dec 2000 20:10:29 -0000 Organization: Another Netscape Collabra Server User Lines: 39 Message-ID: <913c23$9bd5@bornews.inprise.com> References: <3a2d6283_1@dnews> <3a2d6336_2@dnews> NNTP-Posting-Host: host62-7-60-158.btinternet.com X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400