Visual Basic打开表单

时间:2017-07-15 15:55:56

标签: vb.net forms

所以,我正在为我的应用程序创建一个登录屏幕,当你正确登录时,它应该打开form2。但是,当我正确登录时,它打开form2然后很快关闭它。这是我的代码。 (我使用的是bunifu按钮和文本框)

Private Sub BunifuThinButton21_Click(sender As Object, e As EventArgs) Handles BunifuThinButton21.Click
    If BunifuTextbox1.text = "admin" And BunifuTextbox2.text = "adminpass" Then
        Me.Close()
        Form2.Show()
    Else
        If BunifuTextbox1.text = "" And BunifuTextbox2.text = "" Then
            MsgBox("No Username Or Password Found!", MsgBoxStyle.Critical, "Error")
        Else
            If BunifuTextbox1.text = "" Then
                MsgBox("No Username Found!", MsgBoxStyle.Critical, "Error")
            Else
                If BunifuTextbox2.text = "" Then
                    MsgBox("No Password Found!", MsgBoxStyle.Critical, "Error")
                Else
                    MsgBox("Invalid Username And/Or Password!", MsgBoxStyle.Critical, "Error")
                End If
            End If
        End If
    End If
End Sub

0 个答案:

没有答案