Event not raised in client
I have a scenario that falls under the MSDN description of "something interesting has happened and the client app needs to know".
I have an Ax.dll with one class in it, that governs all data access to a database. There is a method, that records operator actions into a log table. After each entry is made into the log table, this class calculates whether or not the log is 90% full. Like so:
' start log calc
lngSize = GetEventLogSize 'get latest size
lngUsed = GetEventLogNoRows 'get latest no. used rows
'Check for 90% and raise event
If (Abs((lngUsed / lngSize) * 100) > 89) Then
RaiseEvent LogTableNearCapacity
' end log calc
The application is an MDI app, and I create an instance of this DataMgr in the Form_Load event of the MDI form. My thought is since this form is always open, why not have him listen for the event. After re-reading in my VB Programmers Guide, events are anonymous broadcasts. If you are listening you can react to the event. So I have declared an object variable like so:
' Gen Dec Section
Private WithEvents oDataMgr As NTCIPDataMgr.DataMgr
' create an instance in the Form_Load event
Set oDataMgr = New NTCIPDataMgr.DataMgr
Then sit back and wait, and when I hear the warning cry do:
Private Sub oDataMgr_LogTableNearCapacity()
EventLogWarning.Show
End Sub
I know the event is firing because I had the dll write to a text file that it performed the calculation and raised the event. Further since an event is a brodcast to the world, I thought I would place a second withevents object variable on one of the child forms to see if the event is raised there. No luck.
Any thoughts?
Thanks
Kevin