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 7686421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:28:37+00:00 2026-05-31T19:28:37+00:00

I have created a program with Windows Forms in C# and the architecture is

  • 0

I have created a program with Windows Forms in C# and the architecture is something like this

* BaseClass.cs
* EntityClass.cs
* ControllerClass.cs
* DataAccessClass.cs
* Viewer.cs

So basically the Entity class inherits from the base class, and the data access class goes and retrieves data from a MySql database.

What I want to do is to be able to use the data pulled without having to call the data access class if I already pulled it once.. where can I put this data so I can access it anywhere?..

I was reading about serializing into memory.. but I want to get a good advise here on where to put it and if possible how. I would really appreciate any pointers.

Regards

  • 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-05-31T19:28:38+00:00Added an answer on May 31, 2026 at 7:28 pm

    Seems like you want to continue with the MVC pattern, and introduce a “Model” component that is shared between your 2 views. The Model would be initialized/refreshed using your DataAccessClass. Each form (or View) should have a reference to the Model. I would not suggest using serialization as you are just sharing an in-memory C# object in the same process between 2 different Forms.

    For example:

    public class MyFirstView : Form
    {    
      private ModelClass m_model;
      public MyFirstView(ModelClass model)
      {
         m_model = model;
         m_model.OnDataRefresh += this.Model_OnDataRefresh;
      }   
    }
    
    public class MySecondView : Form
    {    
      private ModelClass m_model;
      public MySecondView(ModelClass model)
      {
         m_model = model;
         m_model.OnDataRefresh += this.Model_OnDataRefresh; 
      }   
    }
    
    public class ModelClass 
    {
       private DataAccessClass m_dataAccess;
    
       public event EventHandler OnDataRefresh = {}; // fired when data is refreshed
    
       public void EnsureDataIsLoaded();  // queries the db if we haven't already
       public void RefreshData(); // refreshes the data from the db
       public IList<Entity> GetDataList(); // access to data items
    }
    

    For each Form/View, you can use the Form.Load event to refresh the view with the model data. Perhaps you could have a method on the ModelClass.EnsureDataIsLoaded() that will use the DataAccessClass to query the database if the you haven’t already.

    And lastly, if the model changes, you need some way to push the changes to the view(s). One way to do this is have the model fire an event when the data is refreshed, and each view subscribes to that event.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a VB.NET program using windows forms. The program runs on a
I have created 2 windows form applications in a c# program. I did this:
I have created a C# Windows Forms application which I've attempted to make as
In general, I have been having difficulties porting my .NET Windows Forms applications created
I have created a Windows Forms application in .NET 2 using C# that runs
I have created a windows form application: A presentation library with several windows forms
Creating a Windows Forms Application in C#, I have a program that I am
I have created a wysiwyg editor as a standard C# program using the windows
I have created a setup project with VS2008 for a .NET Windows Forms application
I have created Windows Form Program in C#. I have some problems with localization.

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.