Hi,
Hope all of you are well and settling into 2018 :)
I'll break this down into some simple terms as the project is quite complicated to describe, so here's the basics.
Form1 creates a new instance of Form2 and shows it as showdialog - I cannot access the List declaration from Form2, into Form1.
I cannot have global declarations or variables - explained further, below.
What I have tried:
I have two forms, both created in the designer.
Form1 creates a new instance/copy of Form 2 via
Dim NewForm As New Form2
NewForm.ShowDialog()
I am using showdialog but I am happy to use just show but that gives me a new set of problems, which is to find out from Form2, that calling Form, that is creating a new instance/copy of Form2, has been closed.
The project will contain many more forms i.e. Form3, Form4, Form5....Form20, all creating a new copy of Form2 and need to access "that copy of List(of String)" from Form2, so a global declaration of the List(of String) is not possible.
Those calling forms, to Form2 - may also be created via a new form command, from other forms. So keeping track via variables of whether that form has been closed, is no good to me.
On Form2, I have some data that I am storing in a
List(Of String)
In Form2, I have declared at the top of the class:
Dim _Keywords As New List(Of String)
Friend ReadOnly Property Keywords() As List(Of String)
Get
Return _Keywords
End Get
End Property
I need to access (from Form1 ,3,4,5,6....20) the List(Of String) on Form2 before it gets disposed/closed/set to nothing and not any sooner.
At the moment I do this in Form1 after the showdialog:
Dim Kwords As List(Of String) = GlobalFind.Keywords
NewFrm.Dispose
NewFrm=Nothing
in Form1, Kwords list its always empty, I get a count=0 when I look. Hope that makes sense and Thank you for giving me your time (and hopefully a solution I have overlooked).