how to write an event on variable value change I have a class level variable declared and then it's value changed (it is changed from other class object) i need that it raise an event Is that possible and how it's done
how to write an event on variable value change I have a class level variable declared and then it's value changed (it is changed from other class object) i need that it raise an event Is that possible and how it's done
how to write an event on variable value change?
B Letts
well that's good example about BW but still i need to figure out how to raise event on variable value update
i Have found same question on google. Here is the link:
http://director-online.com/forums/read.php 2,14108,16412
I need code sample of variable watcher in VB.NET
raghu_grdr
I will give short description of my app Maybe it will be easyer to help me:
All app long tasks is executed on backGround worker control and when app is started it creates an object of class B wich monitors some fileactivity on certain directorys So basicly i have 3 threads main thread ,background worker thread and class B wich has two more references to timer controls.
When timer function spots some activity it collects data and passes it back to class B there it is analyzed and if needed added to may arraylist of collections with other data(arraylist has reference to class A or is passed from class A) The updated arraylist is passed back automaticly. Then i need to reload my listview control on class A (User interface and some functions) This task is writen on background worker control And if i exetute BW from event raised on class B it never raises the complete event because class B stil exists and timers are still active So i have may background thread busy and any further operations rezult in error because BW can do only one task at a time. So i thougt it would be good that i figure out a way how tu raise event from class A when the arraylist variable is updated.
Maybe it sounds little confusing or silly but i'm new on multithreading (first time using BW) and quite new to VB.NET so plz be patient and thank you for your time and advice
Pwint
Public Class Class1
Public Event MyPropertyChanged()
Private mProperty As Integer
Public Property MyProperty() As Integer
Get
Return mProperty
End Get
Set(ByVal value As Integer)
If value <> mProperty Then
mProperty = value
RaiseEvent MyPropertyChanged()
End If
End Set
End Property
End Class
EnigMa_AnGeL
Ashishkalvade
Wolfgang Kamir