Solved

Set Focus

Posted on 2002-06-16
6
201 Views
Last Modified: 2010-05-02
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
Comment
Question by:Vlad77
6 Comments
 
LVL 4

Expert Comment

by:RichW
ID: 7081522
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
 
LVL 4

Expert Comment

by:Monchanger
ID: 7081584
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
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 7081625
the listview and the form must be visible and enabled before setting focus to it.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Expert Comment

by:ravininave
ID: 7082865
I think that definately ur enabled property of the list view is False.  Make it true and try again.
0
 

Expert Comment

by:haggmar
ID: 7083741
it can be if your form where the listview resides isnt actice
0
 
LVL 6

Accepted Solution

by:
marconovaro earned 50 total points
ID: 7091868
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB6 add a minute to the date time value 8 61
VBS file using code from 2nd file (txt or vbs) 4 31
VBA filters 2 51
vbModal 12 35
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now