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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:32:06+00:00 2026-06-09T09:32:06+00:00

I have one form that opens another form upon clicking a button. When the

  • 0

I have one form that opens another form upon clicking a button. When the new form opens, I have a progress bar complete via a loop, then I want the form to close. Here is the button click event that launches the new form.

    private void calculateButton_Click(object sender, EventArgs e)
    {

        if (checkFormComplete())
        {
            ProgressForm proForm = new ProgressForm();
            proForm.Show();
        }

    }

And here is the code for the new form that completes a progress bar that should then close itself.

    public ProgressForm()
    {
        InitializeComponent();
        for (int i = 0; i < 101; i++)
            calculationProgress.Value = i;

        this.Close();
    }

However, upon running this I get:

Cannot access a disposed object. Object name: ‘ProgressForm’.

And the debugger points to this line of my main form:

proForm.Show();

I’m not sure I understand why, or what the proper way to do this is. How is that line being called after the close statement inside my new form?

  • 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-09T09:32:08+00:00Added an answer on June 9, 2026 at 9:32 am

    The form is trying to close itself before it’s even shown (because you have your code in the constructor). Put your progress bar code and Close() call in the FormLoad or FormShown event instead. Example:

    private void ProgressForm_Shown(object sender, EventArgs e)
    {
        for (int i = 0; i < 101; i++)
        {
            calculationProgress.Value = i;
            Application.DoEvents(); // force the form to update itself
        }
    
        this.Close();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably a basic html/css question... I have a simple one-button form that
I have a .xslt that translates xml from one form to another (I'm not
I have a form that has 90 buttons on it, one button for each
I have one form that has an option to open another (dialogue). I want
I have one windows form file that each time I open it in Visual
I need to make the program which have one form that contains PNG image
I have five buttons on one form that when clicked enables a bool each
I have one form in a PHP (5.2.9-1) application that causes IIS (Microsoft-IIS/6.0) to
I've creating one ASP web application, in that application one form have to update
I have a form that collects information, one piece of which is a phone

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.