Stack Trace in VB6

后端 未结 5 1942
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-13 14:44

Is it possible to get the stack trace information in Visual Basic 6.0. I mean I want to find out the function name and exact line that causes the error similar to .NET stack

5条回答
  •  遥遥无期
    2021-01-13 15:14

    VB6 doesn't seem to have a decent way to do that natively.

    It's a bit cumbersome, but you could put together a custom solution that adds lines to a text file whenever you want it to. Put together a method somewhere that looks like this:

    Public Sub LogCall(message as String)
        Open "c:\My Documents\sample.txt" For Output As #1
        Print #1, message
        Close #1
    End Sub
    

    and then manually call it from your own functions

    LogCall "MyFunction: Line 42"
    

    It doesn't solve the problem, but it might help you narrow it down.

    With regards to your specific error, I would go through and check situations where you're assigning an object to a variable - I find that it's easy to forget the Set keyword and get the exact same error when I least expect it.

提交回复
热议问题