0

A bit of confusion

what to do

I have a form1 in that their is a button by name "login"
by clicking on the button "login" the form2 will be shown
in a form2 their is username and password text boxes and two button one is "ok" and another one is "cancel"

by clicking on a button "cancel" it should return to the form1
how to link the button "cancel"

2
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by GeekByChoiCe
0

no form1 is been hiden

and i tried many times by adding me.close i was unable to close

0

Is form1 still open while Form2 is open? If so then simply do Me.Close in the cancel button.click event.

can u suggest me how to do it please

0

try this:

In your main form use this to show the login form:

Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
		Me.Hide()
		Dim frm As New Form2()
		frm.ShowDialog(Me)
	End Sub

In your Form2 "cancel" click use this:

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
		If Me.Owner IsNot Nothing Then
			Me.owner.Show()
		End If

		Me.Close()
	End Sub
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.