ElectronikBean
Programmer
Hello, and thanks for looking at my problem.
I need to find a way of telling the system to stop running all code, a sort of halt completely, other than just 'Exit Sub' or 'Exit Function'.
I have tried using the err.raise method, but this does not actually stop the code from running. Once the error handler has taken care of it, vb still continues to run other code. The only way seems to be to use a boolean variable, or to check for an error number later on in the code. ie.
if FaultFound then exit sub
or,
if err.number <> 0 then exit sub.
This is an effort to keep the vb more object orientated, and have the code run smoother. If an object class raises an error, then it should be able to activate a halt on all code running.
For example purposes this is a kind of snippet of what I am trying to do...
--------
Public WithEvents Object1 as Class1
Private str as String
sub Example()
str = Object1.Property
'Other code doing other things with this property...
end sub
---------
The property get code then finds an error in obtaining the data, and runs an event and raises an error. When finished, the code continues to run the rest of the 'Other code doing other things' as above.
Once an error is raised with that property, the code should just handle the error then stop.
Thanks
E-Bean
I need to find a way of telling the system to stop running all code, a sort of halt completely, other than just 'Exit Sub' or 'Exit Function'.
I have tried using the err.raise method, but this does not actually stop the code from running. Once the error handler has taken care of it, vb still continues to run other code. The only way seems to be to use a boolean variable, or to check for an error number later on in the code. ie.
if FaultFound then exit sub
or,
if err.number <> 0 then exit sub.
This is an effort to keep the vb more object orientated, and have the code run smoother. If an object class raises an error, then it should be able to activate a halt on all code running.
For example purposes this is a kind of snippet of what I am trying to do...
--------
Public WithEvents Object1 as Class1
Private str as String
sub Example()
str = Object1.Property
'Other code doing other things with this property...
end sub
---------
The property get code then finds an error in obtaining the data, and runs an event and raises an error. When finished, the code continues to run the rest of the 'Other code doing other things' as above.
Once an error is raised with that property, the code should just handle the error then stop.
Thanks
E-Bean