I'm creating a program that basically loops, and between iterations I want it to create a new instance of a form.
Do While 1 = 1
'Run
Dim AutoForm As New Form3
AutoForm.ShowDialog()
AutoForm.Close()
AutoForm = Nothing
'Clean up
Try
Dim oldProc() As Process = Process.GetProcessesByName("SubjectImporter")
oldProc(0).Kill()
Catch ex As Exception
End Try
Try
AutoForm.Dispose()
Catch ex As Exception
End Try
'Threading.Thread.Sleep(MinsUpdateInterval * 60 * 1000)
Loop
However, each iteration of the form seems to be sharing the same variables (same values as when it finishes)
Imports System.Windows.Automation
Public Class Form3
Private PageLoad As Integer = 0
Private Proc As Process
Specifically; Pageload ends as a 3, and subsequently opens on a new instance with value 3. Also; on this form there is a webbroswer, which does not appear to be reset (it remembers login cookie)
Any ideas why this could be happening?
Comments
Post a Comment