FRIENDS,

i want the code for hide the first form in 10 seconds and show the form2.


i have using the below code but it open the second form continously...

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

namespace Steganography
{
    public partial class Form1 : Form
    {
        //for animating the resource file
        int i = 0;
        private Form2 next;
        public Form1()
        {
            InitializeComponent();
            Timer timer1 = new Timer();

            timer1.Interval = 2000;

            // here 1 second = 1000

            // so 60 seconds=60000

            timer1.Start();

            timer1.Tick += new EventHandler(Ticks);
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            //animating i=o declared first
            i++;
            if (i > 8) i = -5;
            switch (i)
            {
                
                

                case 1: pictureBox1.Image = Steganography.Properties.Resources.Rotate1;
                    break;
                    
                case 3: pictureBox1.Image = Steganography.Properties.Resources.Rotate2; break;
                case 4: pictureBox1.Image = Steganography.Properties.Resources.Rotate3; break;
                case 5: pictureBox1.Image = Steganography.Properties.Resources.Rotate4; break;
                case 6: pictureBox1.Image = Steganography.Properties.Resources.Rotate5; break;
                case 7: pictureBox1.Image = Steganography.Properties.Resources.Rotate6; break;
                case 8: pictureBox1.Image = Steganography.Properties.Resources.Rotate7; break;
                case 9: pictureBox1.Image = Steganography.Properties.Resources.Rotate8; break;

            }
      
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {
            
        }

        private void Form1_Mouseclick(object sender, EventArgs e)

        {

            Application.Exit();

        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
        private void Ticks(object sender, EventArgs e)
        {
            next = new Form2();
            next.Show();
            this.Hide();

        }
    }
}

plz give a litte bit of code for me

Here follows code for the timer

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

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        Timer timer1 = new Timer();

        public Form1()
        {
            InitializeComponent();

            timer1.Interval = 10000; //10 sec interval
            timer1.Tick += new EventHandler(Tick); //Tick event
            timer1.Start(); //start timer
        }

        private void Tick(object sender, EventArgs e)
        {
            Form2 Next = new Form2();
            Next.Show();
            this.Hide();
            timer1.Stop(); //Stop timer after tick once
        }

    }
}

Singlem has given you the code you want. His code starts the timer in the constructor and after 10 seconds the timer Tick event rises and opens form2 - exactly as you wanted. Correct? Or do you want to start the timer? If so put the code of the timer (which is not in constructor of the class) into some button event. And will do.
Mitja

thanks a lot i have cleared my doubt,thanks sing

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.