3
Answers

After my form opens up two more forms pop up after. Why?

Caleb Dunn

Caleb Dunn

12y
1.1k
1
What I did was make it so when my progrss bar is done it opens up the actual program, but after the other program is opened two other forms open after a few min or less.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        //*********************************************************/
        //These buttons are the (Yes or No) (Exit or STAY) buttons                   */
        //*********************************************************/

        private void fusionButton2_Click(object sender, EventArgs e)
        {
           //******************************************************/
          //This makes it so yes CLOSES the program and NO keeps               */
         //stays open                                                                                  */
        //*******************************************************/

            DialogResult result;
            result = MessageBox.Show("Do you want to close this program?", "Question", MessageBoxButtons.YesNo);
            if (result == DialogResult.Yes)
            {
                Close();//Closes the program
            }
            if (result == DialogResult.No)
            {
                //Leave empty to do nothing
            }
        }

        private void fusionButton4_Click(object sender, EventArgs e)
        {
            //Minimizes the program

            this.WindowState = FormWindowState.Minimized;
        }

        private void fusionButton3_Click(object sender, EventArgs e)
        {
            //Maximizes and sets Normal
            if (this.WindowState == FormWindowState.Normal)
            {

                this.WindowState = FormWindowState.Maximized;

            }

            else if (this.WindowState == FormWindowState.Maximized)
            {

                this.WindowState = FormWindowState.Normal;

            }

        }

        private void fusionButton1_Click(object sender, EventArgs e)
        {
            //This is the timer

            timer1.Enabled = true;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            //**************************************/
            //This shows the progress bar when open          */
            //Button is pressed                                          */
            //**************************************/
            progressBar1.Minimum = 0;
            progressBar1.Maximum = 100;
            progressBar1.Step = 10;
            progressBar1.PerformStep();
            if (progressBar1.Value == progressBar1.Maximum)
            {
                //This stops the program
                timer1.Stop(); // or Timer1.Enabled = False //Should work also
                MessageBox.Show("               100%");

                this.timer1.Enabled = true;
                this.timer1.Interval = 60000;
                this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
                this.Hide();
                Form2 newform = new Form2();
                newform.Show();




            }
        }
        //This is the pre-made theme I used

        private void fusionTheme1_Click(object sender, EventArgs e)
        {

        }
        //This is a picture box ( For .gifs, jpgs, ect

        private void pictureBox1_Click(object sender, EventArgs e)
        {

        }

        private void pictureBox2_Click(object sender, EventArgs e)
        {

        }



    }
}

Answers (3)