Hi everyone.
Why does the following code work for the Timer and not for the Command button? The code that they contain is exactly the same! (except for the If statement to disable the Timer control.)Thx.Code:Option Explicit Private Sub Command1_Click() Static I As Integer If ListView1.ListItems(1).Selected = True Then I = 1 I = I + 1 If I = ListView1.ListItems.count Then Command1.Enabled = False ListView1.ListItems(I).Selected = True End Sub Private Sub Form_Load() ListView1.ListItems.Add , , "one" ListView1.ListItems.Add , , "two" ListView1.ListItems.Add , , "three" End Sub Private Sub Timer1_Timer() Static I As Integer If ListView1.ListItems(1).Selected = True Then I = 1 I = I + 1 If I = ListView1.ListItems.count Then Timer1.Enabled = False ListView1.ListItems(I).Selected = True End Sub




Reply With Quote