隐藏和关闭无法正常工作

时间:2018-09-07 03:14:57

标签: c# winforms

我有一个带有文本“ X”的标签,并用它来关闭表单。我的登录名中包含以下代码:

private void btnLogIn_Click(object sender, EventArgs e)
{
   if (userLevel.IndexOf("ADMIN") + 1 > 0)
    {
        Save_Data();
        using (AdminGateOpt adminOptions = new AdminGateOpt())
       {
         adminOptions.gUsers = User;
         adminOptions.windowNumber = windowNumber;
         adminOptions.userDetails = userLevel.Split('|');
         adminOptions.ShowDialog();
         Close();
       }
    }
}

..如果userlevel是管理员,则它将转到另一种形式:

private void btnInGate_Click(object sender, EventArgs e)
{
    DialogResult dialogResult = MessageBox.Show("Do you want to go in In-Gate Form?", String.Empty, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
    if (dialogResult == DialogResult.Yes)
    {
        ReadBarCodeInGate gateForm = new ReadBarCodeInGate();
        gateForm.gUsers = gUsers;
        gateForm.windowNumber = windowNumber;
        gateForm.userDetails = userDetails;
        gateForm.ShowDialog();
        Hide();
    }        
}


private void buttonExit_Click(object sender, EventArgs e)
{
    login Login = new login();
    Login.ShowDialog();
    Hide();
}

与其他表单一样,突然变成这样,一旦我按了X标签按钮,它将转到另一种表单,但是它既不会关闭也不会隐藏以前的表单。

0 个答案:

没有答案