Palm
Palm

Reputation: 13

VB.net How to hide dialogue without close the application

I have problem about close() or dispose() function with my barcode reader (Windows Embedded Compact 7). In this case I can only hide() form.

I tried to show Form2 as dialogue but after I clicked the close button (to hide this form and go back to Form1) It made all of my application close

In Form1 (Main):

Public Sub showForm2()

    Dim secForm As New Form2

    secForm.ShowDialog()

End Sub

In Form2:

'close button  

Private Sub closebt_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles closebt.Click 

    Me.Hide() 

End Sub

Upvotes: 1

Views: 1238

Answers (3)

programmer78
programmer78

Reputation: 1

in the index form add in form closing the fallow code:

Form1.Dispose()

Upvotes: -1

selfstudy
selfstudy

Reputation: 523

Go to properties page of the project. In the Application tab, there is a setting:

  • Shutdown mode
    • When startup form closes
    • When last form closes

Choose "When last form closes" to prevent closing the application when your main form closes.

Upvotes: 1

Amrita Srivastava
Amrita Srivastava

Reputation: 384

Form can't be hidden if it is shown as Dialog. If you want to hide the form then use form.show() rather than form.ShowDialog(). Also here is a link

    http://www.vbforums.com/showthread.php?759061-How-can-i-hide-my-second-form-dialog-without-bliking-form-not-closing-my-first-form

Upvotes: 1

Related Questions