Article View: borland.public.csharpbuilder.language.csharp
Article #401Re: Changing properties of object types at once
From: Jon Shemitz
Date: Wed, 14 Sep 2005 20:34
Date: Wed, 14 Sep 2005 20:34
19 lines
1636 bytes
1636 bytes
Jose Porter wrote: > I have a C# database app. I want to change a property > common to all the lables. How can this be done without > explicitly calling each lable. Is there a C# equivelant to > the following Delphi code: > > for i := 0 to Form1.ComponentCount - 1 do begin > if Form1.Components[i] is TLable then > TLabel(Form1.Components[i]).Font.Name := "Arial"; > end; Not directly, no. You can foreach through the form's Controls collection, but this is recursive: each container has its own Controls collection. -- www.midnightbeach.com
Technical Details
Message-ID:
<43288954.B3A1B6A6@midnightbeach.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newsread.com!newsprint.newsread.com!news-out2.kabelfoon.nl!newsfeed.kabelfoon.nl!bandi.nntp.kabelfoon.nl!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<43284245$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,5d82cec20d96ca8e X-Google-Attributes: gid1efe35,public X-Google-Language: ENGLISH,ASCII-7-bit Message-ID: <43288954.B3A1B6A6@midnightbeach.com> Date: Wed, 14 Sep 2005 13:34:28 -0700 From: Jon Shemitz <jon@midnightbeach.com> Reply-To: jon@midnightbeach.com Organization: Midnight Beach X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U) X-Accept-Language: en-US,en MIME-Version: 1.0 Newsgroups: borland.public.csharpbuilder.language.csharp Subject: Re: Changing properties of object types at once References: <43284245$1@newsgroups.borland.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 63.249.104.197 X-Trace: newsgroups.borland.com 1126729989 63.249.104.197 (14 Sep 2005 13:33:09 -0700) Lines: 19 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newsread.com!newsprint.newsread.com!news-out2.kabelfoon.nl!newsfeed.kabelfoon.nl!bandi.nntp.kabelfoon.nl!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail