I'm trying to create an app whereby only password holders such as the admin can close/ exit the app (reasons being that we dont want employees accidentaly exiting the app).
What I thought to do was to create a simple IF statement but it just dosen't seem to work. Has anyone got an idea on how i could accomplish this?
Note: VARIABLE_SHUTDOWN is a global variable
Private Sub ShutdownServerToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ShutdownServerToolStripMenuItem.Click
VARIABLE_SHUTDOWN = 1
Me.Close()
End Sub
Private Sub AdminForm_FormClosing(sender As System.Object, e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
If VARIABLE_SHUTDOWN= 0 Then
e.Cancel = True
ElseIf VARIABLE_SHUTDOWN = 1 Then
Me.Close()
End If
End Sub
I also tried this ussing the my.settings feature but with no success?
Aucun commentaire:
Enregistrer un commentaire