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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:28:11+00:00 2026-06-04T06:28:11+00:00

Ok, i have a closing event on my form. The code inside it fades

  • 0

Ok, i have a closing event on my form. The code inside it fades the form out, then opens the other form. Is there a way i can wait until the fade is done? Here is my code:

    private void form1_closing(object sender, FormClosingEventArgs e)
    {
        if (this.Opacity > 0.01f)
        {
            e.Cancel = true;
            timer1.Interval = 47;
            timer1.Enabled = true;
            timer1.Start();

        }
        else
        {
            timer1.Enabled = false;
        }
    }

    private void timer2_Tick(object sender, EventArgs e)
    {
        progressBar1.Increment(+1);
        label4.Text = progressBar1.Value.ToString() + "%"; 
        if (progressBar1.Value == 100)
        {
            progressBar1.Value = 100; 
            timer2.Stop();
            this.Close();
            Form2 frm2 = new Form2();
            frm2.Show(); 
        }
    }

Basically, form2 is opening early, i want it to wait after the fade effect is done. 🙂

  • 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-04T06:28:12+00:00Added an answer on June 4, 2026 at 6:28 am

    this code should do, I guess.

    private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            for (double i = 1.0; i > 0.0; i-=0.01)
            {
                this.Opacity = i;
                Thread.Sleep(10);
            }
    
      //Handle whatever you want to do here. The control comes here only when the form is faded out.
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code, I open a stream (without closing or disposing it), then
Is there a way to have a ToolStripMenuItem not closing when I click a
How can I call the button1_Click event in the form closing event so I
I have a form on which there is a LogOutEvent and a form closing
I have a piece of code: innerchannel.Closing += Function(sender, e) RaiseEvent Closing(sender, e) End
I have the following HTML code (note no closing tags on <\option> ) generated
At the top of my code for the form I have the following statements
I wonder just what can cause a form not to close. I have a
I have a button click event handler with the following pseudo code: private void
I have a simple Form-Based .NET application. In this I capture the FormClosing Event

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.