0

this my code to open 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

Hoopje
  • 12,677
  • 8
  • 34
  • 50
  • How does your first form (presumably `adduser`) get opened? Where are you running this code? – Justin Ryan May 04 '15 at 08:42
  • possible duplicate of [How to open a new form but closing the old one in VB](http://stackoverflow.com/questions/18491429/how-to-open-a-new-form-but-closing-the-old-one-in-vb) – Justin Ryan May 04 '15 at 08:44
  • first time when run program, login form automatically open when program show MDI parent form that show all child form. I'm Stuck, when user open another form, the recent form close automatically. – Willy Wijaya May 04 '15 at 09:53

1 Answers1

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

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

form2.Mdiparent=MDIParent
form2.Show()
Me.Dispose()
hdkhardik
  • 662
  • 3
  • 22