Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Call an external procedure from a class

Status
Not open for further replies.

lstephane

Programmer
Nov 19, 2002
35
0
0
CA
Hi,

I have a form with some sub-procedures including my errors handling.

Now, I need to call my error handling sub procedure from a class but can't remember how to call a sub-procedure of a form from a class.

Anybody can help me on this ?

Thanks !


Stéphane Lambert, Programmer/Analyst - BI Specialist
Info Quest (IQ), Data Warehouse System
McKesson Canada Corporation

EMail: stephane.lambert@mckesson.ca
 
FirstAidMan,

It may not be as simple as this but I exepect you would have to make the sub procedure in your form public and then call it using MyForm.MyProcedure.

regards Hugh,
 
It's kind of a backwards way of doing it. Your form should be using the class, the class should not be aware of what methods are on the form.

A better design would be to have an ErrorOccurred event in the class, and the form listens for the event (by using the WithEvents keyword when declaring the object). When the class detects an error, it raises the ErrorOccurred event (possibly passing a description as a parameter - or you might make a separate LastError property in the class that the form can read). In the Object_ErrorOccurred procedure on the form, it could pass the error up to your central error handler.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top