Hi Terry,
Here is the one way to do that...
Hope it heps
Do reply
Thanks and Regard
Sakharam Phapale
Public Class Class1
Public Event myClassEvent(ByVal Value As Boolean)
Private m_IsVariableTrue As Boolean = False
Private myThread As Threading.Thread
Public Property myVariable() As Boolean
Get
Return m_IsVariableTrue
End Get
Set(ByVal Value As Boolean)
m_IsVariableTrue = Value
End Set
End Property
Public Sub New()
myThread = New Threading.Thread(AddressOf CheckValue)
myThread.Start()
End Sub
Private Sub CheckValue()
While True
If m_IsVariableTrue = True Then
RaiseEvent myClassEvent(m_IsVariableTrue)
End If
End While
End Sub
Protected Overrides Sub Finalize()
myThread.Abort()
MyBase.Finalize()
End Sub
End Class
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Private WithEvents ObjClass1 As Class1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
ObjClass1 = New Class1()
Timer1.Enabled = True
Timer1.Interval = 3000
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
Private Sub ObjClass1_myClassEvent(ByVal Value As Boolean) Handles
ObjClass1.myClassEvent
MsgBox("Value changed as True")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Timer1.Enabled = False
ObjClass1 = Nothing
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
If ObjClass1 Is Nothing Then Exit Sub
If ObjClass1.myVariable = True Then
ObjClass1.myVariable = False
Else
ObjClass1.myVariable = True
End If
End Sub
End Class
"Terry Olsen" <to******@hotmail.com> wrote in message
news:O5*************@TK2MSFTNGP11.phx.gbl...
I'm writing a class module (to be compiled to .dll). I have a couple of
questions...
1. Is there a way, inside the class, to repeatedly check a value (timer is
not available here), and
2. trigger an event that the main app would catch when the value is true?