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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run Time Error 5 in Compiled Version VB 6.0

Status
Not open for further replies.

Weltman

Programmer
Apr 27, 2001
17
US
I get a run time error 5 (Invalid Procedure or Argument) in the compiled version of my program only, when trying to use the MsgBox Function to display a message in a Click Event Procedure.
Here's the Procedure:
Private Sub Check5_Click(Index As Integer)
On Error Resume Next
'Countem to make sure there's no overvote.
CountChecks(5) = 0
MaxVotes = 2
Call CountemUp5(Index, MaxVotes)
If TooMany Then OverVoteMsg
End Sub
Here's the message:
Public Sub OverVoteMsg()
Response = MsgBox("You cannot exceed the maximum number of votes allowed in this category.")
If Response = 1 Then TooMany = False
End Sub
I have determined that the error is generated only if I use the MSgBox Function, and only in the compiled program.
Can anybody help?
 
When loading a word 2000 document via double clicking on the document icon I receive a run time error '5' error. The options are "END" "HELP". Help does nothing, end loads the document. When in word 2000, or while loading it this error does not occur. Any ideas?
 
Jeff,

Going back a fair way in this thread I'd argue with your position concerning On Error Resume Next. Overall I'd agree with your basic premise, but there are definitley times where - thanks to the limitations of VB and some of intrinsic controls - On Error Resume Next can be a vital tool.

regards,
Mike
 
Mike,
Yes, I would agree with you . . . On Error Resume Next is a vital tool, but only if it is used correctly (for example, a try/catch paradigm). What I was trying to advise against earlier in the thread was the use of On Error Resume Next as the first line of a program to cover all errors in an entire program.
- Jeff Marler B-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top