[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 200
  • Last Modified:

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.
0
andyakira
Asked:
andyakira
1 Solution
 
Ryan ChongCommented:
Try:

List1.RemoveItem 0

or

Call List1.RemoveItem (0)

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

Change it to :

If List1.ListCount > 0 then List1.RemoveItem (0)
0
 
_agj_Commented:
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
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.

 
Mahdi MansourCommented:
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
 
Ioannis ParaskevopoulosCommented:
private sub Button_click()
   list1.clear
end sub
0
 
EDDYKTCommented:
just put

on error resume next


at the beginning

8->
0

Featured Post

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.

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