Same Error Everytime! List1.RemoveItem (0)

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.
Who is Participating?
just put

on error resume next

at the beginning

Ryan ChongCommented:

List1.RemoveItem 0


Call List1.RemoveItem (0)

>>>>> List1.RemoveItem (0) <----------------------invalid procedure call or argument.

Change it to :

If List1.ListCount > 0 then List1.RemoveItem (0)
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

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...
Mahdi MansourDesign Monitoring & Evaluation ManagerCommented:
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
Ioannis ParaskevopoulosCommented:
private sub Button_click()
end sub
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.