[VB.NET][SOLVED]Computer Shop Management System Timer

Discussion in 'Mixed Languages' started by jcgo16, Sep 14, 2012.

  1. jcgo16

    jcgo16 MDL Junior Member

    Sep 16, 2010
    74
    2
    0
    #1 jcgo16, Sep 14, 2012
    Last edited: Sep 14, 2012
    solved


    im having a problem with my timer

    lets say i have 3 computers connected, how should i add different timers to those 3 computers


    example in the listview

    PC 1 | 0:00:00
    PC 2 | 0:00:00
    PC 3 | 0:00:00


    and lets say i disconnected the PC 1
    how should i retain the timers of PC 2 and PC 3
    because when pc 2 move to the row 0
    the timer of pc 2 will be still on row 1
    the same thing with pc 3


    any ideas?
     
  2. stevemk14ebr

    stevemk14ebr MDL Senior Member

    Jun 23, 2010
    267
    48
    10
    just have 3 seperate timers and when a certian item in the list is clicked then someting like timer1.enabled=true in that case the removal of items from the list doesn't affect the timer
     
  3. jcgo16

    jcgo16 MDL Junior Member

    Sep 16, 2010
    74
    2
    0
    #3 jcgo16, Sep 14, 2012
    Last edited by a moderator: Apr 20, 2017
    (OP)
    it might because im updating the pc 2 and 3


    Fixed and Solved

    what i did is this

    Code:
     Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
            If Not ListView1.Items.Count <= 0 Then
                For counter As Integer = 0 To ListView1.Items.Count - 1
                    Select Case ListView1.Items(counter).SubItems(8).Text
                        Case 1
                            ListView1.Items(counter).SubItems(5).Text = Integer.Parse(ListView1.Items(counter).SubItems(5).Text) + 1
                            Dim x As New TimeSpan(0, 0, ListView1.Items(counter).SubItems(5).Text)
                            ListView1.Items(counter).SubItems(4).Text = x.ToString
                    End Select
                Next
            End If
        End Sub