"Boni" <oilia@nospam> schrieb:
thanks for the answer, the drawback of your approaches seems to be, that
the B will be reset to true each time, when the instanstance of the object
is creates. So if I have
dim OA as new A
oA.B=false
dim OA1 as new A 'this reset B in both instances to true!!!
No, that's not the case. Shared variables are only initialized once.
\\\
MsgBox(Test.A) ' 'True'.
MsgBox(Test.B) ' 'True'.
Test.A = False
Test.B = False
MsgBox(Test.A) ' 'False'.
MsgBox(Test.B) ' 'False'.
Dim t As New Test
MsgBox(Test.A) ' 'False'.
MsgBox(Test.B) ' 'False'.
..
..
..
Public Class Test
Public Shared A As Boolean
Public Shared B As Boolean = True
Shared Sub New()
A = True
End Sub
End Class
///
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>