hi, guys here is my question:-

I've created an application for opening text files. there i got two forms.one contains the textbox where the contents of the file will be displayed. there is a button.clicking this will move me to another form which is displaying modally.in the second form i choose file and click open to load the contents. there is another button "Close". now if i click this button the modal form should close and the control should move to the first form. now here is where i've stucked. can anyone tell me how to close a modal form wihout clicking the 'X' in form title bar.

Plz reply soon...

Private Sub Close_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Back.Click
Me.Close()
End Sub

hi waynespangler i think this will close the entire application. but my question is to close only a single form and activate the parent.

regards
Shouvik

Sorry about that, I missed read it. I set up form1 with a button that has in the click event:

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

In form2 I added a button with the following button click:

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

And it works as expected. How is yours different compared to mine?

Hi vishnu varthan,

It's better to start a new thread and ask your question, because this thread is 4 years old and solved.

This question has already been answered. Start a new discussion instead.