I have a Loginform which i coded into the mainform or Form1, then if all the inputed credentials are correct I will be directed to Form2 and then the Loginform will close, and the Form2 contains a logout button, and if I click the logout button I will go back to Loginform and input again the credentials.
I want to close or not to be shown in the taskbar icon the Loginform when I'm successfully login, I only want to see one icon not two icon in the taskbar.
Note: Loginform is in the Form1, and Form2 is another form.
void btnLogin_Click(object sender, EventArgs e)
{
bool error = true;
if ((txtUserLog.Text.Trim() == "") || (txtPassLog.Text.Trim() == ""))
{
MessageBox.Show("Please fill all fields!");
}
cfgotcall.tether(settings);
cfgotcall.engageQuery("SELECT * FROM tblUsers");
unitbl = cfgotcall.tbl;
cfgotcall.untether();
for (int i = 0; i < unitbl.Rows.Count; i++)
{
if ((unitbl.Rows[i].ItemArray.ElementAt(2).ToString().Equals(txtUserLog.Text, StringComparison.OrdinalIgnoreCase)) && (unitbl.Rows[i].ItemArray.ElementAt(3).Equals(txtPassLog.Text)))
{
if (unitbl.Rows[i].ItemArray.ElementAt(4).ToString().Equals("Registrar", StringComparison.OrdinalIgnoreCase))
{
error = false;
i = unitbl.Rows.Count;
cfgotcall.engageQuery("SELECT * FROM tblUsers");
frmInterface sfInterface = new frmInterface();
sfInterface.enable_mnuSIM(true);
sfInterface.ShowDialog();
}
else if (unitbl.Rows[i].ItemArray.ElementAt(4).ToString().Equals("Accounting", StringComparison.OrdinalIgnoreCase))
{
error = false;
i = unitbl.Rows.Count;
cfgotcall.engageQuery("SELECT * FROM tblUsers");
frmInterface sfInterface = new frmInterface();
sfInterface.enable_mnuSAM(true);
sfInterface.ShowDialog();
}
}