Link to home
Start Free TrialLog in
Avatar of aplelois
aplelois

asked on

Add stop and resume

hello,
I have two buttons and one listbox
button1 is (Start) button2 is (Resume)
I would like something so that when I click
Start the name changes to Stop and stop the timer.
for the resume if I stop then click on it to resume
where it was! how can I do that ?

>ListBox1
Label1.Text=ListBox1.SelectedItem

>Timer1
If ListBox1.SelectedIndex >= ListBox1.Items.Count -1 Then
       Timer1.Enabled=False
Else
       ListBox1.SelectedIndex=ListBox1.SelectedIndex + 1
End if

>button1
Timer1.Enabled=True
SOLUTION
Avatar of Brian Mulder
Brian Mulder
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of arif_eqbal
arif_eqbal

Hi bruintje
Sorry was late again :-)
You missed out one thing though....
Say the Timer is Running, and user clicks on STOP to stop the timer, Now we have two options START or RESUME
What I understand is Start should start from the firts item in the listbox while Resume should continue from there.
If that's the case you need to set ListBox1.SelectedIndex=-1 in the Start case
yes you are again correct,

@aplelois better ask a moderator to move the points on this question to arif_eqbal

i'll just stay out of EE for a few hours not that sharp :-)
Avatar of aplelois

ASKER

thank you guys, you both are the best!
We are all learning remember :-) and never mind the points again