Results 1 to 7 of 7

Thread: Invalid procedure call or argument... What is wrong with this code?

  1. #1

    Thread Starter
    Lively Member reisve's Avatar
    Join Date
    Mar 2005
    Posts
    118

    Angry Invalid procedure call or argument... What is wrong with this code?

    Hi I have this code:
    VB Code:
    1. 1 Private Sub Form_Resize()
    2. 2    If UseCommBox <> 0 Then
    3. 3      txtTerm.Move 0, 0, frmTerminal.ScaleWidth, frmTerminal.ScaleHeight - sbrStatus.Height - txtSendText.Height
    4. 4       txtSendText.Move 0, txtTerm.Height, frmTerminal.ScaleWidth, 315
    5. 5    ElseIf UseCommBox = 0 Then
    6. 6       txtTerm.Move 0, 0, frmTerminal.ScaleWidth, frmTerminal.ScaleHeight - sbrStatus.Height
    7. 7     End If
    8. 8 End Sub

    everytime I ru the application, the form resizes ok, but gives me this error message:

    Run-time error '5':
    Invalid procedure call or argument

    Any ideas why?

    Thanks

    Virginio
    Last edited by reisve; Aug 10th, 2006 at 07:15 AM.

  2. #2
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: Invalid procedure call or argument... What is wrong with this code?

    in which line nwhat is the txtterm and use combio give all detail

  3. #3

    Thread Starter
    Lively Member reisve's Avatar
    Join Date
    Mar 2005
    Posts
    118

    Re: Invalid procedure call or argument... What is wrong with this code?

    txtTerm and txtSendText are texbox controls; sbrStatus is a StatusBar; UseCommBox is a variable which can be 0 or something else.

    The errors ocur on lines 3 or 6 depending on the UseCommBox

  4. #4
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: Invalid procedure call or argument... What is wrong with this code?

    Most likely the value for new Width or Height is becoming negetive.
    Add a break point at the beginning of the sub and check the values in every line step by step by pressing F8.

    To overcome this type off errors, it is recommended to use On Error Resume Next in Form_Resize.
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  5. #5
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: Invalid procedure call or argument... What is wrong with this code?

    iprank is true
    use
    On Error Resume Next

  6. #6

    Thread Starter
    Lively Member reisve's Avatar
    Join Date
    Mar 2005
    Posts
    118

    Re: Invalid procedure call or argument... What is wrong with this code?

    well, on error resume next took care of the error message. And since the form resizes ok, I think it resolved

    Thank You guys

  7. #7
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: Invalid procedure call or argument... What is wrong with this code?

    wel
    l, on error resume next took care of the error message. And since the form resizes ok, I think it resolved

    Thank You guys
    When you have received an answer to your question, please mark it as Resolved using the Thread Tools menu.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width