How do I reference form in main application from a class?

Hello,

I need to change cursor on a form within a class, I used to change frmSettings.ActiveForm.Cursor property but from time to time frmSettings.ActiveForm returns null (I guess when it's not currently active form). So how do I do it properly from withing a class



Answer this question

How do I reference form in main application from a class?

  • Adrian Hains

    The proper method of doing this is to pass a reference of your form to your class. This can be set through a property or passed in the form of a constructor.
    e.g. in your frmSettings Load you might say
    MyOtherClass.InChargeOf = this; (assuming C#)


  • How do I reference form in main application from a class?