Finding a Control in a Form at run time

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
 
W

William Stacey [MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top