• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 210
  • Last Modified:

Set Focus

Why ,when I use ListView Object and I write :
ListView1.SetFocus
I receive an error:"Invalid procedure call or argument"
Object is enable ,I cant't understand where is the problem
Please ,help me .
0
Vlad77
Asked:
Vlad77
1 Solution
 
RichWCommented:
Do you have any code in the Listview's events that may be raising this error?  Check your events for the Listview and step through them in debug.
RichW
0
 
MonchangerCommented:
Is the form which it resides on visible at the moment of setting focus ? It must be, or "Invalid procedure call or argument" will occur.
0
 
Éric MoreauSenior .Net ConsultantCommented:
the listview and the form must be visible and enabled before setting focus to it.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
ravininaveCommented:
I think that definately ur enabled property of the list view is False.  Make it true and try again.
0
 
haggmarCommented:
it can be if your form where the listview resides isnt actice
0
 
marconovaroCommented:
This usually happens when you call SetFocus() on the Form_Load, where the destination object (i.e. the one you are trying to setfocus) is not yet visible.
If this is the case, you can use the Form_Activate event, or you can use On Error Resume Next.
Hope this helps you.
Marco
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now