I have a windows application with:
a class called CloseAppl.vb
a form called FormWelcome which is the startup form
the closeAppl.vb cpde is :
Public Class CloseAppl
Dim MainForm As New FormWelcome
Dim Close As MsgBoxResult
Close = MsgBox("Did you saved everything before closing this application? If so click on YES", MsgBoxStyle.YesNoCancel, "Exiting....")
If (Close = vbYes) Then
MsgBox("just click OK and then open FILE and click on 'SAVE'", MsgBoxStyle.Information, "How to save")
in the WelcomeForm I have a mainmenu with a subitem Exit application where I try to call teh closeappl class like this:
Private Sub MenuFileSubCloseappl_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuFileSubCloseappl.Click
Dim CloseObj As New CloseAppl
When i click on the menuItem, I do not get any errors, but the application does not close.
If I change the way to do this and in the menu item i type simply me.close() then it works, but then when I will have another form I will need to add a new line of code to create an istance of the welcomeform and close it, instead, using the class, I can just copy na dpaste to all the other forms.
How I have to use that class ?/ what I am doing wrong in use it ?