Windows Form Components Access

Posted by rxm0203 on Stack Overflow See other posts from Stack Overflow or by rxm0203
Published on 2009-08-04T02:09:46Z Indexed on 2010/05/01 19:57 UTC
Read the original article Hit count: 142

Filed under:
|
|

What is the best way to access components (e.g. imagelist, timer) from a form instance? I am working on multi form windows forms application on .NET Compact Framework version 3.5 SP1 with C#. I have a Controller class associated with each form for MVC implementation. Here is my sample Controller class.

public class Controller
{
      public void Init(Form f)
      {
            //f.Controls will allow access to all controls
            //How shall I access imagelist, timer on form f.
      }
}

My question is how can I access non visual components without taking a performance hit of reflection? Any code snippets are welcome. If reflection is only way, then can you provide me optimal way for components access please?

Thanks,

© Stack Overflow or respective owner

Related posts about .NET

Related posts about compact-framework