AnsweredAssumed Answered

Why is my form remembering?

Question asked by deleted-user-VeC5jUIlNXtq on Jan 22, 2014
Latest reply on Jan 22, 2014 by deleted-user-VeC5jUIlNXtq
Hey all,

I have an Add-In where the user browses to a FGDB (returns a string of the FGDB path and adds it to a label on the form). I have another label that has the string of a file path, and then 2 combo boxes (choose a layer).

The user is unable to proceed unless all parameters are filled out, so if they navigate to a FGDB, but forget to add the required layers, they close the form, add the data, and re-open the form.

EDIT: "Close the form" = stop the Add-in, add the data, then re-launch the add-in.

However, my form is remembering the file paths (they're also stored in a public string variable).

My question is, what am I doing incorrectly about closing the form and not disposing (?) of all the variables. The combo boxes are cleared, but the variables and the labels which store the paths remain intact.

Here's the code for the form:

Public Class frmProgress      Private Sub btnBrowseGPX_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowseGPX.Click         Call Procedures.GetGPXPath()     End Sub      Private Sub btnBrowseGDB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowseGDB.Click         Call Procedures.GetGDBPath()     End Sub      Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click         ' Close the form, but continue with the code in Procedures.         Me.Hide()         bContinue = True     End Sub      Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click         ' Exit the Do loop in Procedures using the continue boolean and close the form.         bContinue = False         Me.Close()     End Sub      Private Sub frmProgress_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing         If e.CloseReason = Windows.Forms.CloseReason.UserClosing Then             bContinue = False             e.Cancel = False         End If     End Sub End Class

The program has a Do loop so that if they attempt to proceed without filling out the parameters, it will get mad, but keep the form open. Thus the reason for the Me.FormClosing handle.

Anyways, I'm going to review some other Add-Ins I have which have similar functionality, I'm sure it's just a small oversight, but if you can think of anything of the bat, that would be greatly appreciated!