• Welcome to Valhalla Legends Archive.
 

Error 5 - Invalid Procedure Call or Argument

Started by Grok, October 25, 2004, 09:33 AM

Previous topic - Next topic

Grok

Error 5 is one of the least-intuitive errors that VB throws.


        Case "Field"
            'get parent(fields).parent(profile).name
            Set mProfile = KI.Profiles(Node.Parent.Parent.Text)
            Set mField = mProfile.Fields(Node.Text)


Consider the above code.  The last line throws the error sometimes.  The value of Node.Text is valid, with the value being one of the keys in the Fields collection.  The Fields collection exists, the mProfile object exists.  Yet that line throws error 5 in rare circumstances.

Wish I knew why.  Anyone here really understand VB error 5?

LivedKrad

In any and all cases, can you guarantee that all of your objects or values are absolutely valid throughout the entire procedure?

Adron

Have you been able to reproduce in the debugger? What about getting a dump file? :P

Grok

Quote from: Adron on October 25, 2004, 12:21 PM
Have you been able to reproduce in the debugger? What about getting a dump file? :P

Ah, yes, the AdronVBErrorDump DLL .... I should find that again.

MyndFyre

Quote from: Grok on October 25, 2004, 02:22 PM
Quote from: Adron on October 25, 2004, 12:21 PM
Have you been able to reproduce in the debugger? What about getting a dump file? :P

Ah, yes, the AdronVBErrorDump DLL .... I should find that again.

Out of curiousity, do you have a conditional Dim?  That is, is mField being declared sometimes and sometimes not, depending on your code path?
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Grok

Quote from: MyndFyre on October 25, 2004, 02:23 PM
Quote from: Grok on October 25, 2004, 02:22 PM
Quote from: Adron on October 25, 2004, 12:21 PM
Have you been able to reproduce in the debugger? What about getting a dump file? :P

Ah, yes, the AdronVBErrorDump DLL .... I should find that again.

Out of curiousity, do you have a conditional Dim?  That is, is mField being declared sometimes and sometimes not, depending on your code path?

No conditional Dim.  Didn't know I could anyway.  Plus, at the point of error when I let the program break, it is on that line and the values of everything are defined.  The count is correct and the key I am looking for is in the collection.   Item is the default property of the collection.  The class is solid afaik, getting 10,000+ calls per day by about 5 different processes.

Adron

Quote from: Grok on October 25, 2004, 02:45 PM
No conditional Dim.  Didn't know I could anyway.  Plus, at the point of error when I let the program break, it is on that line and the values of everything are defined.  The count is correct and the key I am looking for is in the collection.   Item is the default property of the collection.  The class is solid afaik, getting 10,000+ calls per day by about 5 different processes.

But you've got it in the debugger? If you have, shouldn't it be easy to figure just by picking out one piece of the statement at a time and evaluating that?