I have a main form (form1) and when I press a Load Button, it executes a bunch of code on the main page and then ultimately spawns a new Form (i.e. Form2). However, control ultimately stays with form1, as I am operating in an infinite loop on Form 1.
From Form1
Ultimately, Form2 will Spawn another form, Form3.
If the person presses the Load Button on Form1 again, even if I invoke Form2.Close() and Form3.Close() from the button press, the forms do not close, most likely because the code behind those two forms is still executing. Hence, I get a duplication of forms. Rather, I want the previous processes to stop so I can close the forms when new data is entered into the system. I believe this is done with multi-threading but I don't know how to set this up and associate with the two forms I wish to close. Can anyone provide guidance? Thanks
From Form1
VB.NET:
Dim Form2 = New ChartingForm
Form2.Show()
ExitInfLoop = False
Do Until ExitInfLoop = True
Application.DoEvents()
Form2.DynamicChartCreation(dt)
Loop
Ultimately, Form2 will Spawn another form, Form3.
VB.NET:
'At this point you can view thumbnails of the associated components
If ThumbnailView = True Then
Form3 = New ThumbnailForm
Form3.ThumbnailListCreation(dt, DataPointIndex, RemChartLevel, YearSelect, MonthSelect)
Form3.Show()
ThumbnailView = False
End If
If the person presses the Load Button on Form1 again, even if I invoke Form2.Close() and Form3.Close() from the button press, the forms do not close, most likely because the code behind those two forms is still executing. Hence, I get a duplication of forms. Rather, I want the previous processes to stop so I can close the forms when new data is entered into the system. I believe this is done with multi-threading but I don't know how to set this up and associate with the two forms I wish to close. Can anyone provide guidance? Thanks