First thing to understand: most usually, you do something not "from class", but "from a class instance", unless the "other class" method is static. Likewise, and more importantly, the "form" means the instance of some class derived from
System.Windows.Forms.Form
. Normally, the controls you mentioned in the questions, are the
instance members of some
Form
class; therefore, you need an instance, a reference to the form instance, to read or modify the state of the control or any control's properties.
It does not matter how you pass the instance. For example, you can have "other class" with constructor which accept a parameter of specific form class. In a form class, you can expose a control, so you would have its reference through the form reference:
myMainForm.myLabel.Text = "Done";
However, this is not a clean or neat way of doing things. It's really bad to expose controls directly. If some class has reference to some form controls, this class should better be the same form (one good idea: the same
partial
declaration in a separate file, but a part of the same class).
It's much better to expose some functionality. The class working with the form does not have to "know" this is the form. It's better be some interface instance exposing only the interface members required to implement some functionality. The form class implements some interface. The idea is explained in my article:
Many Questions Answered at Once — Collaboration between Windows Forms or WPF Windows.
Don't be confused: the article explain collaboration of a form with a form or a WPF window with a window, just because this is one of the frequently asked questions (very frequently :-)). But nothing changes if this is the collaboration between a form and some object of a non-form class.
—SA