单击按钮打开MDIPARENT表单 [英] Open MDIPARENT Form on Button Click

查看:83
本文介绍了单击按钮打开MDIPARENT表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个登录表单,并且在身份验证后单击确定"后,它应该打开我的主表单(这是MDIParent).我尝试了所有可能的方式,但无法做到这一点.有人可以帮我吗?

Hello All,

I have a login form and after authenticationm when I click on OK, it should open my Main form(which is a MDIParent). I tried in all possible ways but am unable to do that. Can anyone help me with this?

Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
        Try
            Dim AuthData As New GetData.GetData()
            Dim DT As DataTable = AuthData.GetAuthentication(UsernameTextBox.Text, PasswordTextBox.Text)
            Dim Password As String = DT.Rows(0).Item(0).ToString
            If (Password = PasswordTextBox.Text) Then
                MsgBox("Login Successful")
                Me.Close()
                MainForm.Show()
            Else
                MsgBox("Invalid Password. Please Try Again")
            End If
        Catch EX As Exception
            MsgBox("UserName Not Registered. Please enter a Valid Username and Continue")
        End Try
    End Sub



MainForm是一个MDI容器,我要在成功登录后尝试打开它.
请帮助我.



MainForm is a MDI Container which i am trying to open after successful login.
Please Help Me.

推荐答案

转到项目属性,然后在应用程序"选项卡下检查设置为Startup formShutdown mode的内容.如果将其设置为When startup form closes,则关闭登录表单后,您的应用程序将结束.
Go to project properties and check under application tab what is set as Startup form and Shutdown mode. If it is set to When startup form closes, your application will end when you close the login form.


这篇关于单击按钮打开MDIPARENT表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆