Form Hide

D

Davis

Hi, I have another question.

Again i have a main form which upon a button click loads another
form as below :

Private Sub B_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles B.Click

Dim frm As New Form1

frm.Show()

End Sub

In the second form when i exit i call Me.Hide ie i hide the form. When i return to the Main form

again and the button is clicked its creating another new form each time. What do i need to do to prevent

this.I just want to show my form again but the event handler for the button creates a new form each time.

Thanks
 
B

Bipin_Expert

Hi,
I think there can be two ways to do this:

1) You can show another form without minimize button. This will show
"OK" on left , so each time user will have to close it and your event
on Main form will create new instance of the form.

2) You can declare a new form object in a module, and call each time
your application requires it.
Public NewForm as frmNew
' In Sub Main declare
NewForm = new frmNew
' On button click of Main Form
NewForm.Show
' On close of new form , hide it.

Regards,

Bipin Kesharwani
(Developer)

Palewar Techno Solutions
Pocket PC & Mobile Software Development
Nagpur, India

http://www.palewar.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top