Access form controls from Class in c#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SimhachalamNaidu
    New Member
    • Jul 2008
    • 2

    Access form controls from Class in c#

    i have a form namee Form1. and i have a class myclass.now what i need is i want to modify controls of Form1 from myclass. please notice that Controls in Form1 are runtime user controls. please help me for that. Thanx
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    You need a handle (reference) of that form in your class.
    Classes shouldn't be allowed to change whatever they want anywhere.

    Comment

    • SimhachalamNaidu
      New Member
      • Jul 2008
      • 2

      #3
      just i need to access the controls on the form.so i need to first access that form.

      Comment

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #4
        Originally posted by SimhachalamNaid u
        just i need to access the controls on the form.so i need to first access that form.
        The controls are properties/members of that form. You can't get to them unless you can get to the form. The only things you can get without having an instance are statics but then those do not belong to an instance either ...

        Comment

        Working...