PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Framework Forms Finding a Control in a Form at run time

Reply

Finding a Control in a Form at run time

 
Thread Tools Rate Thread
Old 25-06-2003, 10:23 PM   #1
Shahin Kohan
Guest
 
Posts: n/a
Default Finding a Control in a Form at run time


Greetings,

I have a form with many controls on it. At run time I like to be able to get
the control from the form using its name. For example

GetControl(SomeControlName) as control

is there a way to do this without going trough all the controls and checking
their name one by one.

Shahin


  Reply With Quote
Old 27-06-2003, 07:24 AM   #2
William Stacey [MVP]
Guest
 
Posts: n/a
Default Re: Finding a Control in a Form at run time

Maybe add a Public property to the form that references the control itself.
Then from any form that has a reference to the form, you can get that
control by name via the public property.

--
William Stacey


"Shahin Kohan" <shahin@valleris.com> wrote in message
news:%23p%23yhh2ODHA.2228@tk2msftngp13.phx.gbl...
> Greetings,
>
> I have a form with many controls on it. At run time I like to be able to

get
> the control from the form using its name. For example
>
> GetControl(SomeControlName) as control
>
> is there a way to do this without going trough all the controls and

checking
> their name one by one.
>
> Shahin
>
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off