shared menber life time?

  • Thread starter Thread starter Hei
  • Start date Start date
H

Hei

Hi All,

i have a problem about a class that have a shared member. in my app have
frmA and frmB, frmB is call by frmA use ShowDialog, frmB have a member
"_Prescriptions as ArrayList" that is use to contain a list of prescription
and i use a function "CreatePrescription" (see below) to add "prescription"
to this. after i close the frmB and show it again, the Shared member
_GiveQty is remenber the value.

what time the shared member value will reset?
i want reset the value when close frmB, do i need do something to handle?

Private Function CreatePrescription
dim a as prescription
_Prescription.add(a)
End Function

Public Class Prescription
Private Shared _GiveQty As Integer
Public Property GiveQty() As Integer
Get
Return _GiveQty
End Get
Set(ByVal Value As Integer)
_GiveQty += 1
End Set
End Property
End Class

thx
Hei
 
Hei,
If this is a Windows Forms application the shared member will be 'reset' the
next time the program is executed.

For ASP.NET applications I understand it will be "reset" when the current
AppDomain is discarded and a new AppDomain is loaded.

Hope this helps
Jay
 
Back
Top