Sharing Structures of Arrays in multiple MDIchilds

sijcooke

Member
Joined
Nov 29, 2009
Messages
9
Programming Experience
10+
Hi All,
Thanks in advance for any help given.

I have created an MDIparent form and a MDIchild. There is a button on the parent which makes multiple 'clones' of the child form, each time its clicked.

I also want (maybe with a module) a set of variables, and array of a structure but these are available to each copy of the child, but each copy's variables, arraylist etc contain its own data???

Therefore if you select child1 the variables and array will have different data to child2, child3...etc...

Any help would be great,
Thanks, sijcooke
 
I would hope that there's no cloning going on. I would hope that you have designed a form and then you simply create multiple instances of that form, just as you create multiple instances of other classes. If you want to share data among all instances then you can declare one or more members Shared. Any member declared Shared belongs to the class itself, rather than to any specific instance of the class. As such there is only one copy for the whole application.
VB.NET:
Private Shared data1 As String

Private data2 As String
If an instance changes data1 then every other instance will see that change too, while changes to data2 will be isolated to the current instance.
 
Thanks for the reply - and no i dont mean clones, but multiple instances of mdichild.
I have the following...

In the Module1:
Public MyArrayList as new Arraylist
Public MyInstance as MyStructure

Structure MyStructure
Public Value1 as string
Public Value2 as string
End Structure

In the Class1:
Various lines of code which put data into the Myinstance and then save the instance into the ArrayList.

In the FormChild:
I have buttons which run procedures and functions in the formchild and also in the Class1.

----
I need it so you can jump between formchild instances, and when you do so and click a button on that form, it will run the Class1 code but using the data in the arraylist and myinstance that was set previously by the selected formchild. Then if you switch to another child it uses data from this form.

Can this be done by declaring the arraylist with more dimensions and then refer to the records with the index of the selected form instance, e.g.
Selected Child is index(3)
When calculating in Class1 - MyArraylist(3,REQUIREDrecordnumber) ??????

Hope this makes sense!!
Thanks for any help given again!!
Sijcooke
 
Back
Top