I have a menu item to log out and transfer the page. Sometimes when tapping that, the user accidentally taps the GoogleMap behind it, and its mapclick event fires (and crashes because curUser = Nothing)
While I added a check in the Mapclick event to make sure the MainPage was the current form, I feel like after setting a MainPage, other event handlers on the form should stop firing, because we are leaving. Is this intended behavior? thanks
Andrew
Private Sub btnLogOut_Click(sender As Object, e As EventArgs) Handles mnuLogOut.Click
CookieHelper.DeleteCredentialCookies() ‘Clear login credentials from cookie.
Application.Session(“user”) = Nothing ‘Clear user variable (in Session)
Me.curUser = Nothing ‘Clear user variable (on form)
Application.Session.IsLoggedOn = False ‘Change Logged on to false
Application.MainPage = New frmLogin ‘Navigate to frmLogin
End Sub
That’s the correct behavior since the object is valid, leaving or not leaving is an application concept. When you change the MainForm it’s up to your code to dispose the previous one. Otherwise the pages are reusable.
Please login first to submit.