当用户提交表单时,如何让它自动关闭?

时间:2022-06-28 20:35:26

this my code to open addUserform

这是我打开addUserform的代码

 Dim adduser As New frmadduser
        adduser.MdiParent = Me
        adduser.Visible = True
when user open ChangePassword form
Dim changepassword As New frmchangepassword
        changepassword.MdiParent = Me
        changepassword.Visible = True

I want to ask, how to close current form automatically after user open changepassword form. Iam use me.close, that's code not work.Thankyou

我想问一下,如何在用户打开changepassword表单后自动关闭当前表单。我使用me.close,那个代码不起作用.Thankyou

1 个解决方案

#1


How you will close current form? if you are dealing with MDI Parent form , then it will not close. please make sure that which form you wanna close

你将如何关闭当前表格?如果您正在处理MDI父表单,那么它将不会关闭。请确保您想要关闭哪种形式

for example if you are on Form1 and you want to open Form2 then you can do following steps.

例如,如果您在Form1上并且要打开Form2,则可以执行以下步骤。

form2.Mdiparent=MDIParent
form2.Show()
Me.Dispose()

#1


How you will close current form? if you are dealing with MDI Parent form , then it will not close. please make sure that which form you wanna close

你将如何关闭当前表格?如果您正在处理MDI父表单,那么它将不会关闭。请确保您想要关闭哪种形式

for example if you are on Form1 and you want to open Form2 then you can do following steps.

例如,如果您在Form1上并且要打开Form2,则可以执行以下步骤。

form2.Mdiparent=MDIParent
form2.Show()
Me.Dispose()