Results 1 to 16 of 16

Thread: Invalid procedure call or argument.

  1. #1

    Thread Starter
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036

    Invalid procedure call or argument.

    Hi, why does the .SetFocus method raise the following error :
    Invalid procedure call or argument.

    VB Code:
    1. Private Sub Timer3_Timer()
    2. Me.text4.Enabled = True
    3. Me.text4.SetFocus
    4. Me.Timer3.Enabled = False
    5. End Sub
    tia
    Regards
    Jorge
    "The dark side clouds everything. Impossible to see the future is."

  2. #2
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    Re: Invalid procedure call or argument.

    Is the form that this code is in visible? If it isn't then that is what is causing the error
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

  3. #3

    Thread Starter
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036

    Re: Invalid procedure call or argument.

    Yes the form is visible
    "The dark side clouds everything. Impossible to see the future is."

  4. #4
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: Invalid procedure call or argument.

    And is the Text4 textbox on any Frame or Picture box which itself is disabled?
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  5. #5

    Thread Starter
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036

    Re: Invalid procedure call or argument.

    Yes its on a enabled and visible frame.
    Jorge
    "The dark side clouds everything. Impossible to see the future is."

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Invalid procedure call or argument.

    Quote Originally Posted by Asgorath
    Hi, why does the .SetFocus method raise the following error :
    Invalid procedure call or argument.

    VB Code:
    1. Private Sub Timer3_Timer()
    2. Me.text4.Enabled = True
    3. Me.text4.SetFocus
    4. Me.Timer3.Enabled = False
    5. End Sub
    tia
    Regards
    Jorge
    I just tried your code and it works fine for me. What line is highlighted when the error occurs?

  7. #7
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: Invalid procedure call or argument.

    Can you try this code and let us know what it does?
    VB Code:
    1. Private Sub Timer3_Timer()
    2.     Me.text4.Enabled = True
    3.     If Not Me.text4.Container.Enabled Then
    4.         Debug.Print "SetFocus Cannot be used"
    5.     Else
    6.         Me.text4.SetFocus
    7.     End If
    8.     Me.Timer3.Enabled = False
    9. End Sub
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  8. #8
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Invalid procedure call or argument.

    Quote Originally Posted by Hack
    I just tried your code and it works fine for me. What line is highlighted when the error occurs?
    I just disabled the frame, ran the code, and got the Invalid procedure error.

    Somewhere along the line, your frame is being disabled.

  9. #9

    Thread Starter
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036

    Re: Invalid procedure call or argument.

    Hi, i've modified to code to this and i still the invalid error.
    VB Code:
    1. Private Sub Timer3_Timer()
    2. Me.Visible = True
    3. Me.text4.Visible = True
    4. Me.text4.Enabled = True
    5. Me.Frame1.Enabled = True
    6. Me.Frame1.Visible = True
    7. MsgBox Me.text4.Container.Name
    8. If Me.text4.Container.Enabled Then
    9.     MsgBox "enabled"
    10. Else
    11. MsgBox "disabled"
    12. End If
    13. Me.text4.SetFocus
    14. Me.Timer3.Enabled = False
    15. End Sub
    Jorge
    "The dark side clouds everything. Impossible to see the future is."

  10. #10
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Invalid procedure call or argument.

    What is the Timer Interval? When is this code executing? At Form Load?

  11. #11

    Thread Starter
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036

    Re: Invalid procedure call or argument.

    I erased the frame and moved the textboxes to the form and i still get the warning that the container is disabled.
    Jorge
    "The dark side clouds everything. Impossible to see the future is."

  12. #12

    Thread Starter
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036

    Re: Invalid procedure call or argument.

    Quote Originally Posted by brucevde
    What is the Timer Interval? When is this code executing? At Form Load?
    The timer is fired only once from another from. Interval 1.
    Jorge
    "The dark side clouds everything. Impossible to see the future is."

  13. #13
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Invalid procedure call or argument.

    VB Code:
    1. I erased the frame and moved the textboxes to the form and i still get the warning that the container is disabled.

    Seems like the Form is not enabled then...

  14. #14

    Thread Starter
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036

    Re: Invalid procedure call or argument.

    But i've got form.enabled = true just before the setfocus.
    Jorge
    "The dark side clouds everything. Impossible to see the future is."

  15. #15
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Invalid procedure call or argument.

    zip up your project and attach it here

  16. #16
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Invalid procedure call or argument.

    VB Code:
    1. But i've got form.enabled = true just before the setfocus.
    Not according to the posted code.

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