VB.net How to hide dialogue without close the application

Multi tool use
VB.net How to hide dialogue without close the application
I have problem about close() or dispose() fucntion with my barcode reader (Windoes Embeded 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
@SSpoke It cause message received from Windows Message amount increase every time I enter the "scan form". Ex. First time I enter the form and scan, I recieve only one barcode message (from batch by
WndProc
) then I press back or change form then re-enter the scan form again I will received 2 messages per one scan, next time It will be 3, 4, 5 . . . messages. about this problem I don't know why– Palm
Jul 3 at 6:54
WndProc
2 Answers
2
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
Go to properties page of the project. In the Application tab, there is a setting:
Choose "When last form closes" to prevent closing the application when your main form closes.
I can't set Shutdown mode. It's not in the application setting.
– Palm
Jul 4 at 7:08
It's not application settings, It's project properties. Right click on project and select properties. In the application tab you will find it.
– selfstudy
Jul 4 at 7:15
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
no reason why it would close.
– SSpoke
Jul 3 at 6:45