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

  • Home
  • SEARCH
  • 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 8742017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:25:33+00:00 2026-06-13T11:25:33+00:00

I have one class where I store my data: class Model { public int

  • 0

I have one class where I store my data:

class Model
{
   public int Progress{ get; set; }
}

Second class where I can modify this data and notify subscribers about changes:

class Copy
{
   //...
   public static event EventHandler Changed;
   Model model = new Model();
   ProgressForm progressForm = new ProgressForm();

   public void Start()
   {
      for(int i=0;i<100;i++)
      { 
         model.Progress++;
         if(Changed!=null)
           Changed(this,EventArgs.Empty);
      }
   }

   //...
}

and something like this:

class ProgressForm
{
    Model model;
    public ProgressForm()
    { 
       model = new Model();
       Copy.Changed+=new Changed(ShowProgress);
    }

    void ShowProgress()
    {
       progressBar1.value = model.Progress;
    }
}

How can I change data for each model separately and show this data in ProgressForm when I run two or more instances of Copy?

Main()
{
   Copy copy = new Copy();
   copy.Start();
   Copy copy2 = new Copy();
   copy2.Start();
}
  • 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-13T11:25:34+00:00Added an answer on June 13, 2026 at 11:25 am
    public class Model
    { 
        public int progress;
        public event EventHandler ProgressChanged;
    
        public int Progress
        {
            get { return progress; }
            set 
            { 
                progress = value;
                if (ProgressChanged != null)
                {
                    ProgressChanged(this, null);
                }
            }
        }
    }
    
    public class Copy
    {
        public List<Model> models = new List<Model>();
        public event EventHandler CopyProgrss; // FormModel binded to this event. 
        public void AddModel(Model m)
        {
            this.models.Add(m);
            m.ProgressChanged += new EventHandler(m_ProgressChanged);
        }
    
        void m_ProgressChanged(object sender, EventArgs e)
        {
            Model currentModel = sender as Model;
            int modelProgress = currentModel.Progress;
            if (CopyProgrss != null)
                CopyProgrss(modelProgress,null); // here you can caluclate your over progress. 
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one class. Class First { private Second second; public First(int num, String
I can't figure out why I'm getting this error. I only have one class
Let's say I have this code: class Score { public Update(int score) { update
i have one single class for margin and i am using this class to
I have this one class: say InterClass . This class is declared in say,
I have a Java model similar to: public class Country { @Id private String
I have a data model with an entity called Image. This will be used
I have one class called Global and two other activities. In each activity I
I'm making a program on the HUFFMAN ALGORITHM where I have one class of
I have one main class with several inherited members who all overload the same

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.