为什么我的表没有关闭/隐藏?我的

由网友(感情,越扯越淡。)分享简介:我不明白为什么我的登录表单不打烊或者即使我已经在使用this.Hide躲起来了,我试图从然后打开另外一个关闭,第二种形式是开放,但登录仍存在运行这是为什么?这里是我的code 公共无效verifyAccount(){变种hashedPassword = getPassword来();VAR散列器=新的散列器();ha...

我不明白为什么我的登录表单不打烊或者即使我已经在使用this.Hide躲起来了,我试图从然后打开另外一个关闭,第二种形式是开放,但登录仍存在运行这是为什么? 这里是我的code

 公共无效verifyAccount()
        {
            变种hashedPassword = getPassword来();

            VAR散列器=新的散列器();

            hasher.SaltSize = 16;

             hasher.CompareStringToHash(txtPassword.Text,hashedPassword);

            如果(!hasher.CompareStringToHash(txtPassword.Text,hashedPassword))
            {
                的MessageBox.show(无效的用户名或密码);
            }
            其他
            {
                主窗口主=新的主窗口();

                main.ShowDialog();
                this.Hide();
            }
        }
 

编辑:随着人民发表评论,我发现了如何将我关在日志中形式的理念,这是我的解决方法

 主窗口主=新的主窗口();
                this.Hide();
                main.ShowDialog();
                this.Close();
 

解决方案

main.ShowDialog(); 是一个阻塞调用。控制不会运行到下一行,直到关闭主窗口。

为什么我的EXCEL表格不能取消隐藏了

I don't get it why my Log in form is not closing or hiding even though I am already using the "this.Hide, I am trying to close the from then opening another one, the second form is opening but the Log in is still there running why is that? here is my code

public void verifyAccount()
        {
            var hashedPassword = getPassword();

            var hasher = new Hasher();

            hasher.SaltSize = 16;

             hasher.CompareStringToHash(txtPassword.Text, hashedPassword);

            if (!hasher.CompareStringToHash(txtPassword.Text, hashedPassword))
            {
                MessageBox.Show("Invalid UserName or Password");
            }
            else
            {
                MainWindow main = new MainWindow();

                main.ShowDialog();
                this.Hide();
            }   
        }

EDIT: With the peoples comment I found an Idea of how will I close the log in form, here's my workaround

MainWindow main = new MainWindow();
                this.Hide();
                main.ShowDialog();
                this.Close();

解决方案

main.ShowDialog(); is a blocking call. Control will not run to the next line until you close the main window.

阅读全文

相关推荐

最新文章