I currently have two forms, which are the main form and the login form.
My main form is my Application.Run(); and my login form is just a dialog box.
I have already created a function for the reloading of data. My problem is if i log out of my main form, then login again, the main form would not automatically refresh. I have placed my refresh function on the form_load event. I tried creating a button for the refresh and its working just as I wanted it to. How can I make my refresh function automatically change once I login another user?
This is on my program.cs:
Application.Run(new Main_Form());
This is whats of inside my main form:
public partial class Main_Form : Form
{
Login log = new Login();
}
private void Main_Form_Load(object sender, EventArgs e)
{
log.ShowDialog();
}
private void logoutToolStripMenuItem_Click(object sender, EventArgs e)
{
DialogResult dialogResult = MessageBox.Show("Are you sure you want to logout?", "Logout", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes)
{
spms.classes.FormProvider.MainMenu.Hide();
log.uname.Text = ("");
log.pwd.Text = ("");
log.ShowDialog();
log.uname.Focus();
}
}
When you close your login window:
For your Dialog you have to set
this.DialogResult = DialogResult.OKfor the login button or your controls if you logged in.