Solved

Same Error Everytime! List1.RemoveItem (0)

Posted on 2004-08-10
6
175 Views
Last Modified: 2012-05-05
I think its trying to delete what's not there anymore.  After I press the stop button, i make it clear the lists, and disable timer. but this error always pops up afterwards.  is there a way to fix this?

In A Timer:

If List1.ListCount > 0 Then
 List1.Selected(0) = True
    Parsemeth1 (List1.List(0))
    List1.RemoveItem (0) <----------------------invalid procedure call or argument.
    If List1.ListCount = 0 Then
        Timer4.Enabled = False
        End If
        If Text44 = "0" Then
        Timer4.Enabled = False
        End If


 thank you.
0
Comment
Question by:andyakira
6 Comments
 
LVL 49

Expert Comment

by:Ryan Chong
ID: 11769623
Try:

List1.RemoveItem 0

or

Call List1.RemoveItem (0)

cheers
0
 
LVL 14

Expert Comment

by:aelatik
ID: 11769974
>>>>> List1.RemoveItem (0) <----------------------invalid procedure call or argument.

Change it to :

If List1.ListCount > 0 then List1.RemoveItem (0)
0
 
LVL 7

Expert Comment

by:_agj_
ID: 11770004
if u clear the list when u press ur stop button, can see how it enters the loop:

If List1.ListCount > 0 Then   <---this should be 0

also  why do u do this: List1.Selected(0) = True
                                  Parsemeth1 (List1.List(0))

when u do a:
        Timer4.Enabled = False

also set: Timer4.interval = 0.

i have a feeling this is because of multiple timers...are u disablign the correct timer?

also...set a breakpoint in this function and check the value of listcount etc..

i am also wondering if it shud be .Remove(1).....forget whats the base of a list...
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 1

Expert Comment

by:Mahdi Mansour
ID: 11770779
if what u r trying is only to clear the list and stop the timer use :

Private Sub Timer1_Timer()
If List1.ListCount > 0 Then
 List1.Selected(0) = True
   
    List1.RemoveItem (0)
  End If
   If List1.ListCount = 0 Then
      Timer1.Enabled = False
      End If
   

End Sub
0
 
LVL 23

Expert Comment

by:Ioannis Paraskevopoulos
ID: 11771368
private sub Button_click()
   list1.clear
end sub
0
 
LVL 26

Accepted Solution

by:
EDDYKT earned 80 total points
ID: 11771776
just put

on error resume next


at the beginning

8->
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

760 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

24 Experts available now in Live!

Get 1:1 Help Now