By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,403 Members | 891 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,403 IT Pros & Developers. It's quick & easy.

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

P: 4
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 ?
Nov 23 '14 #1
Share this Question
Share on Google+
4 Replies

Expert Mod 5K+
P: 9,731
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?

Nov 24 '14 #2

P: 4
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 :
Expand|Select|Wrap|Line Numbers
  1. formclass objformclass = new formclass ();
  2. Objformclass.lbl1.text = " text updated";
  3. similarly, objformclass.btn=true;
No error on compilation but not effective.
* msg sent from mbl, excuse if spelling mistakes *
Nov 24 '14 #3

Expert Mod 5K+
P: 9,731
Well, you could implement the INotifyPropertyChanged 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.

Nov 24 '14 #4

P: 4
Can you give me small example? ( this is my first C# programme )
Nov 25 '14 #5

Post your reply

Sign in to post your reply or Sign up for a free account.