Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error function causes runtime error Invalid procedure call or argument

Status
Not open for further replies.

MargeJones

Programmer
Feb 22, 2002
12
0
0
US
I have a VB project I created and when the user clicks a button, I have the code going through and looking for screen errors, such as fields that should have values in them. Whenever there is an error, I use the Error function to force the code to go to the routine's error handler. The error handler throws the code to an error class that I wrote that handles all VB errors and other forced errors. I use error number 0, so my code looks like this:

If text1.text = "" then
'code to populate error fields for error handler go
'here

Error 0
End If

Recently every time it gets to the Error 0 code, it causes a runtime error 5 "Invalid procedure call or argument". Does anyone know if there is a limitation on using this function? I have close to 200 forms, modules, classes, and user controls that use the function. Also, I have tried replacing the Error 0 with using the Err.Raise, and it causes the same error.
 
I believe you are not supposed to use whole ranges of error numbers as they are now reserved by VB.

Try this for more details:
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
In addition to checking on the best error number to use, I suggest that you take a look at the Raise method of the Err Object. Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top