|
-
Sep 27th, 2001, 10:43 AM
#1
Thread Starter
Fanatic Member
Raising Errors to a common module
I have been using RaiseEvents to get my errors in my lower classes up to my superclass. (Thanks Honeybee) I would now like to raise an event from the superclass to let the calling application know there has been an error. It seems as though that it is not possible to check for events in a module, you have to use a class or a form (which I am not using in my code).
Is there a way around this?
-
Sep 27th, 2001, 12:28 PM
#2
This may not be it but check your error trapping settings under
Tools -> Options -> General Tab in VB
Regards
Sean
-
Sep 27th, 2001, 01:31 PM
#3
Well ...
There is no way of raising events from a standard module, but if you are using classes, you should not need any standard modules. Anyway, one method is to raise an error as soon as you trap the error event of the subclass. So if some code is using functions from your standard module which use class methods, an error will be encountered by the class method, raised to the module by way of an event, and in this event you can again use Err.Raise statement to return the error back to the calling program.
I really think you should not need standard modules in classes, but if you want to know that's how it could be done.
.
-
Sep 27th, 2001, 01:46 PM
#4
Thread Starter
Fanatic Member
I confused you a little bit. The standard module would not be in my class project but in my EXE project.
I did not see a way to get an Event that was raised in the class project to be recognize by the EXE project except for using Err.Raise. Am I missing something?
-
Sep 28th, 2001, 09:00 AM
#5
Well ...
When declaring reference variables for your classes, use the WithEvents keyword, such as:
Dim WithEvents MyObj As clsMyClass
Now, you can select MyObj from the dropdown list of controls in the IDE and use its events.
.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|