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

Invalid procedure call or argument

Status
Not open for further replies.

ASPVBNerd

Programmer
Nov 23, 2005
83
SE
On our xp machines we recive an error "Invalid procedure call or argument", but it works on our windows 2000 machines.

When i debugg the application on win xp machine i recive the error message after
Code:
textSearchEntry.Setfocus

What should i do to fix this?
 
In what procedure/event is this error occuring?

If it is the form load then you will need to move that line to the form activate event.

zemp
 
It's in the Private Sub UserControl_Show().
There is no activate and I am not using a form. It is a Usercontrol

George
 
I think that it is likely the same basic issue. The textbox is not actually created yet (doesen't exist) and you are trying to set focus to it. You will most likely have to find an event after the .show is complete to set your focus to the text box.

zemp
 
Okay, but I can't find an event that I can use to setfocus after the .show

Does anybody know what kind an event that could be?

George
 
You could create one
Code:
Public Sub SetTheFocus()
   textSearchEntry.Setfocus
End Sub

[small]No! No! You're not thinking ... you're only being logical.
- Neils Bohr[/small]
 
Setfocus" is not even properly capitalized; should be "SetFocus". Sure sign that this particular object does not have this method yet.



 
Golom, I have tried your example. I call the SetTheFocus sub last thing I do in the UserControl_Show
Code:
Private Sub UserControl_Show()

    TopFrame.Visible = True
    WorkFrame.Visible = True

    strUser = "ADMIN"
    SetTheFocus

End Sub

Public Sub SetTheFocus()
   EANCode.SetFocus
End Sub

I still get the error message "Invalid procedure call or argument".

Any kind of help is appreciated.

George
 
You are still calling it from within the original show event.

Try using the resize event or the gotfocus event to set focus to the textbox. I am not 100% sure of the order of events for the user control, but a lillte trial and error should give you a good idea.


zemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top