Threading practices question in VB.NET / .NET in general. Sharing data?
Posted on 2007-03-19
I have some questions about threading practices in .NET
I have the Form1 class and a separate class "TestNET"
In Form1 I have several variables, array lists and structures defined. These things are all populated with information from a database onLoad. Immediately following this I create 10 new instances of TestNET that I want to share this data with.
Is it safe for me to reference Form1.(variable) in the TestNET class or is this dangerous? See an example of what I mean below:
Public Class TestNET
Dim Settings as Form1.StructInfo
Dim Var1 as Form1.SomeVar
Public Class Form1
Public SomVar as String
Public StructInfo as SomeStruct
Dim TNETS(10) as TestNET
Public Structure SomeStruct
Dim Item1 as String
Dim Item2 as String
Private Sub Form1_Load()
**** pretend we populate SomeVar & StructInfo from database
' create new TestNET oibjects now that the data is ready
For x = 0 to ubound(TNETS)
TNETS(x) = New TestNET