I am newbie to programming and using window form application i have 2 forms Form1 and Form2, i wanted to open old form application i.e Form1 here is my code of Form2 Code: 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 SQL1 { public partial class Form2 : Form { public Form2() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { this.Visible = false; ________________?? } } } i simply wanted if user click on signout button which is on Form2 then Form1 window Application open can Any one help me its my assignment please help me......!
Re: Form Applications: How to Redirect The User Form To Login Form in c#?Form Applica Hey Dude, This is a hack. Maybe there are other C# developers that may comment to this solution of mine. Anyway, this will work as prescribed in your requirements. @ the First Form PHP: namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { //instantiate an object from form2,pass an object to form2 //passing the same reference of the current form Form2 f2 = new Form2(this); //hide current form this.Hide(); f2.Show(); } } } @ FORM 2 PHP: namespace WindowsFormsApplication1 { public partial class Form2 : Form { //object fro form1 Form1 f1; public Form2(Form1 cf) { InitializeComponent(); //set a new instance of form1 f1 = cf; } private void Form2_FormClosed(object sender, FormClosedEventArgs e) { //on closing show the new object f1.Show(); } private void button1_Click(object sender, EventArgs e) { this.Close(); } } }