Home > DeveloperSection > Forums > How can i create a Process?
Jaya J
Jaya J

Total Post:9

Points:63
Posted on    March-13-2015 4:14 AM

 .NET C# 
Ratings:


 2 Reply(s)
 752  View(s)
Rate this:
I have 4 forms namely form1,form2,form3,form4.

form2 is main form.when i open form1(Login Page),it will open form2.After that form1 has to close.Form2 opens form3 through openform3 Button click.
After opening Form3,user doesn't doing in form3,it will automatically killed.

All this can be done using a single Process.Is it Possible?If possible tell me the code please........


Kamlakar Singh
Kamlakar Singh

Total Post:194

Points:1396
Posted on    March-13-2015 8:19 AM

Try this code:
Form1 Code:
public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Form2 f2 = new Form2();
            f2.Show();
        }
    }

Form2 Code:

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

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

        private void button1_Click(object sender, EventArgs e)
        {
            new Form3().Show();
        }

        private void Form2_Shown(object sender, EventArgs e)
        {
            new Form1().ShowDialog();
        }
    }

Form3 Code:

public partial class Form3 : Form
    {
        public Form3()
        {
            InitializeComponent();
        }
        Timer t;
        private void Form3_Load(object sender, EventArgs e)
        {
            t = new Timer();            
            t.Tick += t_Tick;

            t.Start();
        }

        void t_Tick(object sender, EventArgs e)
        {
            if (t.Interval == 60000)
                this.Close();
        }
    }

Jaya J
Jaya J

Total Post:9

Points:63
Posted on    March-14-2015 12:41 AM

Form2 is opened when login was successful(ie Form1).I write code for that.But when Form2 is opend,there is no use of Form1.So I have to close form1 when Login was successful.And Form3 is automatically close when there is user interaction with that Form3.
And all this sholud be done in one Process.i.e,Process.Start()........
I'm asking code for this.Please Help me.

Don't want to miss updates? Please click the below button!

Follow MindStick