I use this code
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
My.Settings.Str -= 1
My.Settings.Save()
Label2.Text = My.Settings.Str
If My.Settings.Str >= 0 Then
FrmLogin.Show()
Me.Close()
End If
If My.Settings.Str <= 0 Then
MsgBox("Your trial has Expired, Please Buy a key", MsgBoxStyle.Information, "Trial Expired")
FrmRegister.ShowDialog()
End If
End Sub
But when i run the form and press the button will close all forms when i use me.hide the code running whitout any problem can i know if there is any porblem on the code please
CodePudding user response:
With default project settings, your application will be closed when the startup form is closed. If you want to change this behaviour:
- Right click on your project in the Solution Explorer
- Select Properties
- Select the Application tab
- Under Shutdown mode, select "When last form closes" (see image below)
Another idea would be to leave the default settings and change your startup form...