Hi, why does the .SetFocus method raise the following error :
Invalid procedure call or argument.
tiaVB Code:
Private Sub Timer3_Timer() Me.text4.Enabled = True Me.text4.SetFocus Me.Timer3.Enabled = False End Sub
Regards
Jorge
Printable View
Hi, why does the .SetFocus method raise the following error :
Invalid procedure call or argument.
tiaVB Code:
Private Sub Timer3_Timer() Me.text4.Enabled = True Me.text4.SetFocus Me.Timer3.Enabled = False End Sub
Regards
Jorge
Is the form that this code is in visible? If it isn't then that is what is causing the error
Yes the form is visible
And is the Text4 textbox on any Frame or Picture box which itself is disabled?
Yes its on a enabled and visible frame.
Jorge
I just tried your code and it works fine for me. What line is highlighted when the error occurs?Quote:
Originally Posted by Asgorath
Can you try this code and let us know what it does?VB Code:
Private Sub Timer3_Timer() Me.text4.Enabled = True If Not Me.text4.Container.Enabled Then Debug.Print "SetFocus Cannot be used" Else Me.text4.SetFocus End If Me.Timer3.Enabled = False End Sub
I just disabled the frame, ran the code, and got the Invalid procedure error.Quote:
Originally Posted by Hack
Somewhere along the line, your frame is being disabled.
Hi, i've modified to code to this and i still the invalid error.
JorgeVB Code:
Private Sub Timer3_Timer() Me.Visible = True Me.text4.Visible = True Me.text4.Enabled = True Me.Frame1.Enabled = True Me.Frame1.Visible = True MsgBox Me.text4.Container.Name If Me.text4.Container.Enabled Then MsgBox "enabled" Else MsgBox "disabled" End If Me.text4.SetFocus Me.Timer3.Enabled = False End Sub
What is the Timer Interval? When is this code executing? At Form Load?
I erased the frame and moved the textboxes to the form and i still get the warning that the container is disabled.
Jorge
The timer is fired only once from another from. Interval 1.Quote:
Originally Posted by brucevde
Jorge
VB Code:
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...
But i've got form.enabled = true just before the setfocus.
Jorge
zip up your project and attach it here
Not according to the posted code.VB Code:
But i've got form.enabled = true just before the setfocus.