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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:27:25+00:00 2026-05-31T18:27:25+00:00

I have a Form class partial class ProgressMainForm : Form { public ProgressMainForm() {

  • 0

I have a Form class

    partial class ProgressMainForm : Form
    {
      public ProgressMainForm()
      {
        InitializeComponent();
      }
    }

And then a class that uses that class and contains all functionality for the user

    public class ProgressForm
    {
        public ProgressMainForm myProgressForm;

        public ProgressForm(string title)
        {
            myProgressForm = new ProgressMainForm();
            myProgressForm.Text = title;
        }

        public void SetProgressBar(int min, int max)
        {
        ....
    }

I then use this ProgressForm class in my project like this

            progresswindow = new ProgressForm("Replacing All Strings");

This way progresswindow only contains members that are related to the functionality of the ProgressForm and all those Form members are hidden from the user.

But sometimes I need to access those Form members, for example when I need Invoke method.

Is there a way to make myProgressForm in ProgressForm accessible to users without making ProgressMainForm public?

Or is this approach wrong?

  • 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-31T18:27:26+00:00Added an answer on May 31, 2026 at 6:27 pm

    In my opinion you should not work with the form directly. If I read your setup correctly, you want to show progress indicator while some job is being done. ProgressForm should expose methods to set the counters and increment them; as you run it on another thread, form manipulation should be done from inside the methods of ProgressForm. Your Invokes belong there, wrapped in suitable methods. If you want to change some visual properties of ProgressMainForm relay those properties to ProgressForm.

    To resume, calling code should have no clue what ProgressForm does other than setting progress boundaries, starting, setting current percentage and stopping. This way, if you are asked to port the application to another UI system the amount of code you will need to change will be drastically reduced.

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

Sidebar

Related Questions

Currently, I have something like: public partial class Form1 : Form { delegate void
I'm looking at some Java classes that have the following form: public abstract class
I have the following: public partial class Form1 : Form { public Form1() {
I have this code: public partial class Form1 : Form { public Form1() {
I have the following code: public partial class Form1 : Form { public BindingList<Class>
i have a problem with this code: public partial class KnihovnyForm : Form {
I have a problem in a same namespace: public partial class frmForm1 : Form
I have a Form with some private properties namespace TestApplication { public partial class
I have a parent form first.cs like this public partial class first : Form
I have a little splash window: public partial class Splash : Form { bool

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.