create an instance of form into non form class to access button/label

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dipak000
    New Member
    • Nov 2014
    • 4

    create an instance of form into non form class to access button/label

    Hi,
    I have a non form class. I want to update label/ check status of check box etc.. in non form class ( here resides functions that contains logic). How can i do that ?
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Labels, CheckBoxes etc. are graphical user interface controls that let the end user interact with your system.

    If you do not have a form, then what do you have as a graphical user interface?

    -Frinny

    Comment

    • dipak000
      New Member
      • Nov 2014
      • 4

      #3
      I have an form that contains label, 2 buttons and. Check box. I have separated a logic in to another class ( non form class ). I want to update the status of operation ( which is being executed in non form class) in to form label also activate some buttons. But not effective. I made all components public from private. Created an object of form class then accessed the elements. Ex :
      Code:
      formclass objformclass = new formclass ();
      Objformclass.lbl1.text = " text updated";
      similarly, objformclass.btn=true;
      No error on compilation but not effective.
      * msg sent from mbl, excuse if spelling mistakes *
      Last edited by Frinavale; Nov 24 '14, 09:52 PM.

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        Well, you could implement the INotifyProperty Changed Interface and raise property changed notification events every time a property is changed.

        Then in your form's code-behind you could catch the property changed events and update the GUI controls that correspond to the property that was changed.



        -Frinny

        Comment

        • dipak000
          New Member
          • Nov 2014
          • 4

          #5
          Can you give me small example? ( this is my first C# programme )

          Comment

          Working...