hi i want to show my 2nd form then close the 1st form. here's that simple codes and i can't do it right. please help

Private Sub btlogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btlogin.Click

    form2.show()
    me.close()

End Sub

Recommended Answers

All 4 Replies

Member Avatar for Rahul47

What you are doing is:

form2.show() 'showing form2
    me.close()    'closing form1 which is main form. Upon closing it application terminates.

Try following

In coding of form1:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Form2.Show()
End Sub

In coding of form2:

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Form1.Hide()
End Sub

thanks for the reply. but from what i ask it is possible?

Member Avatar for Rahul47

but from what i ask it is possible?

I already explained why your approach failed.

okay thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.