erlleonardo
New member
- Joined
- Jan 25, 2012
- Messages
- 4
- Programming Experience
- Beginner
First of all good day to all member i need your help guys please help me about Count Down Timer using listview
i'm getting headache of this code of mine. i been working of this for 1 week and i cannot solve this problem.
my problem is if set the time to listview the first i set it will work fine but when i was set to other player time
the first running time in listview will reset and get the same time on my second player time start.. here is my code.
 
And here is my attach Resource
	
		
			
		
		
	
				
			i'm getting headache of this code of mine. i been working of this for 1 week and i cannot solve this problem.
my problem is if set the time to listview the first i set it will work fine but when i was set to other player time
the first running time in listview will reset and get the same time on my second player time start.. here is my code.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Timer1.Start()
        With ListView1.Items.Add("Player1")
            .SubItems.Add(1).Text = ("00:00:00")
            .SubItems.Add(2).Text = ("0")
        End With
        With ListView1.Items.Add("Player2")
            .SubItems.Add(1).Text = ("00:00:00")
            .SubItems.Add(2).Text = ("0")
        End With
        With ListView1.Items.Add("Player3")
            .SubItems.Add(1).Text = ("00:00:00")
            .SubItems.Add(2).Text = ("0")
        End With
    End Sub
    Private TimeLaps As Date
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Dim remainingTime As TimeSpan = TimeLaps.Subtract(Date.Now)
        For Each itm As ListViewItem In ListView1.Items
           
            If Not TimeLaps < Date.Now Then
                If Not itm.SubItems(2).Text = (Int(itm.SubItems(2).Text) < 0) Then
                    itm.SubItems(1).Text = String.Format("{0:d2}:{1:d2}:{2:d2}", _
                                                 remainingTime.Hours, _
                                                 remainingTime.Minutes, _
                                                 remainingTime.Seconds)
                Else
                End If
            Else
            End If
        Next
    End Sub
    Private Sub AddTimeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddTimeToolStripMenuItem.Click
        ListView1.SelectedItems(0).SubItems(2).Text += 180
        TimeLaps = Date.Now.AddMinutes(ListView1.SelectedItems(0).SubItems(2).Text)
    End Sub
   
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        With ListView1.Items.Add(TextBox1.Text)
            .SubItems.Add(1).Text = ("00:00:00")
            .SubItems.Add(2).Text = ("0")
        End With
    End Sub
End Class
And here is my attach Resource
Attachments
			
				Last edited by a moderator: 
			
		
	
								
								
									
	
		
			
		
		
	
	
	
		
			
		
		
	
								
							
							 
	 
 
		 
 
		 
 
		 
 
		 
 
		