Finding a Control in a Form at run time

  • Thread starter Thread starter Shahin Kohan
  • Start date Start date
S

Shahin Kohan

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
 
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.
 
Back
Top