PDA

View Full Version : Capture event in a form



kunguito
12-11-2009, 05:20 AM
In a class module called CErrorLogSender I have
Public Event ErrorLogSend(ByVal message As String)
Public Sub SendLog(message As String)

RaiseEvent ErrorLogSend(message)
End Sub


A process at some execution point uses the previous procedure to send error messages that i want to be captured by a form and write them on a list.

Public Sub MyProcedure()
Dim sender As CErrorLogSender
Set sender=new CErrorLogSender
...
Call sender.SendLog("Procedure failed")
...
End Sub


How do I do it?

CreganTur
12-15-2009, 10:41 AM
I'm not certain, but the logical option to me is to use the form's On Error function to call this method explicitly whenever an error occurs.

kunguito
12-15-2009, 05:33 PM
Never mind, I just wanted to give realtime feedback of a batch process.
I thought I could raise an event at each batch step and capture it outside the class module. I saw the flaw and finally passed a command (pattern) to the procedure that linking this process to a receiver (textbox on a form).

Thanks anyway cregan!