🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.csharpbuilder.language.csharp
Article #480

Re: C# FindComponent()

#480
From: L Hill
Date: Sat, 22 Jan 2005 00:50
40 lines
1754 bytes
I think i just made one unless there is a better option:

private Control FindControl(string ctrl)
{

    Control retval = null;

    f oreach (Control control in Controls)
        {
            if (ctrl == control.Name)
                retval = control;
        }


return retval;

}



"L Hill" <hillla@yahoo.com> wrote in message
news:41f19e6d$1@newsgroups.borland.com...
> Is there a Windows forms.Net (C#) equivalent for the
> FindComponent("ComponentName") function in Delphi?
>
> To do something like this:
>
> --------------------------------------------
> var
>   aComp: TComponent;
>
> aComp := FindComponent("EditBox1");
> if Assigned(aComp) then
>   (aComp as TEditBox).Text = "Hello";
> --------------------------------------------
>
> Thanks in advance.
>
>
Technical Details
Message-ID: <41f1a34d@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!proxad.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <41f19e6d$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,4151d34871fb2178
X-Google-Attributes: gid1efe35,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "L Hill" <hillla@yahoo.com>
Newsgroups: borland.public.csharpbuilder.language.csharp
References: <41f19e6d$1@newsgroups.borland.com>
Subject: Re: C# FindComponent()
Date: Fri, 21 Jan 2005 19:50:31 -0500
Lines: 42
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
x-mimeole: Produced By Microsoft MimeOLE V6.00.2800.1441
NNTP-Posting-Host: 65.32.211.210
Message-ID: <41f1a34d@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1106355021 65.32.211.210 (21 Jan 2005 16:50:21 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!proxad.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail