Logout Problem
I have made one toolstrip LOGOUT in my MDI form, i want that on logout, when the user click LOGOUT then the control will go to the LOGIN form, and then the user have to login again. how i can do this please help me out with this.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Kirtan PatelPosted Oct 26, 2009, 8:15 AM
Here i Have coded Example for what you want to do ..exactly your scenario . if yout still dont undertand after reading
below description then I have also Included My Project Files that I Used to Explain you this Just take a look at them you will get better idea
Download Project Files
and don't forget to mark "Do you like this answer " please :)
------------------------------------------------------------------
I have two Forms as Below Image
LoginForm and MDI Form (With toolStrip having Logout Button)
Now For Sample Just Assume that User Enters Correct Password and Username So he should be go to MDI form ...
assume that password and username = 12345
Login Button Code The LoginForm Will Be like below
private void btnLogin_Click(object sender, EventArgs e)
{
if (textBox1.Text == "12345" && textBox2.Text == "12345")
{
//if Login Successful Show MDI and Hide Login Form
MDIForm f = new MDIForm();
f.Show();
//Clear the Login Form Info
textBox1.Text = "";
textBox2.Text = "";
// Hide the Login Form
this.Hide();
}
}
and In MDI Form Code For Logout Button will be Below
private void toolStripButton1_Click(object sender, EventArgs e)
{
//Locate the Previously Hided Login Form And Show it
Form f = Application.OpenForms["Login"];
f.Show();
// Close the MDI Form
this.Close();
}
Sriram RamaniPosted Oct 26, 2009, 7:55 AM
jingePosted Oct 26, 2009, 7:20 AM