Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7749649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:05:42+00:00 2026-06-01T11:05:42+00:00

Newbie question. I have two c# classes – a code class (say, CodeClass) and

  • 0

Newbie question.

I have two c# classes – a code class (say, CodeClass) and a form class (say, FormClass). In CodeClass I have a number of functions which I will use to periodically update a string within the class (I can use a property or whatever is appropriate). I want some way of notifying other classes when this string value changes. i.e., I’ll try to have FormClass subscribe to change events on string message and then print the value to a text box or similar. However, at some point in the future, I need to provide API functions from CodeClass – so basically I need a way to notify any subscribing class of changes in the string message (string message does not get modified anywhere outside CodeClass – it happens within functions in CodeClass). I have tried with events and delegates etc but these all seem to be implemented by an external class modifying the string message (property).

Regards, etc

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T11:05:43+00:00Added an answer on June 1, 2026 at 11:05 am

    You need to implement the INotifyPropertyChanged interface:

    class CodeClass : INotifyPropertyChanged
    {
    
        private string _myProperty;
        public string MyProperty
        {
            get { return _myProperty; }
            set
            {
                _myProperty = value;
                OnPropertyChanged("MyProperty");
            }
        }
    
        #region INotifyPropertyChanged implementation
    
        public event PropertyChangedEventHandler PropertyChanged;
    
        protected virtual void OnPropertyChanged(string propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
            handler(this, new PropertyChangedEventArgs(propertyName));
        }
    
        #endregion
    
    }
    

    In FormClass, you can subscribe to the PropertyChanged event like this:

    codeClass.PropertyChanged += codeClass_PropertyChanged;
    
    ...
    
    void codeClass_PropertyChanged(object sender, PropertyChangedEventArgs e)
    {
        if (e.PropertyName = "MyProperty")
        {
            ...
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Quick newbie question. Let's say I have the following code in Vim: void main()
MVC newbie question re binders. Supposing I have two strongly typed partial actions that
Newbie question. I have Django models that look like this: class Video(models.Model): uploaded_by =
Swing newbie question... I have a system where there is a large number of
a newbie question I have a Django project with two applications core and nagios
This is a newbie question in R. If you have two libraries in R
Complete rails newbie trying to get started. I have two classes, Ingredient, and Unit.
FNH Newbie question - I have two objects RR and TT defined as following:
Newbie question... So I have two activities, Cherry and Apple, and each one has
This is a newbie question. I have two javascript and one html files. When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.