473,473 Members | 4,257 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

shared menber life time?

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
Nov 20 '05 #1
1 979
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

"Hei" <ch******@msn.com> wrote in message
news:u7*************@TK2MSFTNGP12.phx.gbl...
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

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

96
by: BadPony | last post by:
Anyone using Peoplesoft on a Federated UDB (shared nothing)Environment on Open System Platforms? Preferably AIX, but any war stories would be good. TEA EB-C
11
by: Ian Bell | last post by:
Apologies for the last post; got the topic wrong. What is the current thinking on the best way to solve the shared data problem i.e. accesssing a shared variable in a non atomic way can give...
7
by: Mark Kamoski | last post by:
Hi Everyone-- Please help. What are the implications, (in terms of memory, application footprint, resource use, threading, and so forth), of using Shared methods? These Shared classes raise...
4
by: John Kraft | last post by:
Hi all, My question is more of a phylisophical one here, but I am wondering what the difference is (effectively and performance wise) between using a shared variable/static variable and using a...
1
by: Eduardo Azevedo | last post by:
If I have a class with method Shared, when this objects are destroies what's happend with the objects Shared? How long is the lifetime of a function shared in the Class ? there are no...
1
by: daFou | last post by:
Please help me how to access shared members in my global.asax in ASP.NET 2.0 This is what i do. First I create a new website using VS.NET 2005. I select a location where the website should be...
4
by: Cc | last post by:
hi , how do I get menber of a structure on runtime? for eample Structure Person <VBFixedString(10)> Public ID As String <VBFixedString(15)> Public Name As String End Structure
2
by: Aaron Cutlip | last post by:
I have been looking all over and have seen many possible ways to create a Syncronized Shared Function in VB.NET, but I would like some advice that will make my life easier. Given the following...
18
by: coachjerry | last post by:
I'm a senior citizen with a tech background, though a newbie to programming and style sheets. I'm usually able to make HTML and css changes to existing designs, but I'm stuck on this one and would...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.