error.stack() not an array?

Error.stack is an array of strings.

So why (in app.UnhandledException event) can I do

MsgBox join( error.Stack, EndOfLine )

but not

MsgBox error.Stack( 0 )

I get “There is more than one item with this name and it is not clear to which this refers”

Very puzzled …

Markus

It’s a method that returns an array. Your first line of code is equivalent to

dim e() as string = error.Stack()
Msgbox join(e, EndOfLine)

Thanks, but I’m not quite sure what to make of what you said.

Function UnhandledException(error As RuntimeException) As Boolean MsgBox join( error.Stack, EndOfLine ) // <- works MsgBox error.Stack( 0 ) // <- does NOT compile End Function

MsgBox error.Stack( 0 ) // <- does NOT compile

tries to pass a parameter (0) to a method that takes no parameters

IF it would compile you’d need something like

MsgBox error.Stack( )(0) // error.Stack returns an array of which you want the 0th element

I was trying to point out the presence of an intermediate value, provided by the compiler. Your second line of code would have to be written using an explicit intermediate value, since the compiler cannot provide it for you.

dim e() as string = error.Stack()
Msgbox e(0)

Thanks! Got it now.