|
Post by brotchie on May 24, 2007 7:44:23 GMT -5
Hey All,
Not sure if this is a limitation of VB itself, an obscure bug or me being stupid.
If I make a new class that implemented the IObject interface with an equals method as follows:
Public Function Equals(ByRef Value As Variant) As Boolean Equals = False Throw New Exception End Function
Then I have a procedure structured as follows, where testObject has the Equals method shown above:
Dim salTestList As ArrayList Private Sub Command1_Click() On Error GoTo CatchIt
Set salTestList = New ArrayList Dim tstObj As New testObject salTestList.Add tstObj MsgBox salTestList.Contains(4) CatchIt: MsgBox "Exception or Error occured" End Sub
I get the standard vb dialog for an unhandled error, rather than program execution jumping to the CatchIt label.
Are On Error Goto * statements local? Or will a similar statement buried somewhere within the .Contains call stack nix my error handler?
ps. Sorry for non-indented code, not sure how to make the tabs visible on these forums!
Interested to hear people thoughts.
|
|
|
Post by Kelly Ethridge on May 24, 2007 22:21:23 GMT -5
Hello,
I'm just wondering if you have your error trapping set to "Break on Unhandled Errors" in the Tools->Options->General settings.
Kelly
|
|
|
Post by brotchie on May 25, 2007 5:46:25 GMT -5
Hey Kelly,
Thanks for the quick reply, glad it was something that simple!
I remember seeing this in passing somewhere, I should have been more observant.
Cheers, James
|
|