Jump to content

cbox


Using timespan get the string to subtract listview sub item


codewarrior

Recommended Posts

Posted

Hey guys is there any one can help me about this code? I want to Subtract

the value of Listview SubsItem if the String Format in time span got 59

it will automatically subtract 1 for subitem tag

 

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
For Each itm As ListViewItem In ListView1.Items

If CDate(itm.Tag) > Date.Now Then

remainingTime = CDate(itm.Tag).Subtract(Date.Now)

itm.SubItems(1).Text = String.Format("{0:d2}:{1:d2}:{2:d2}", _
remainingTime.Hours, _
remainingTime.Minutes, _
remainingTime.Seconds)


If itm.Tag(String.Format("{2:d2}").ToString = 59) Then ' <======== This part is the error
itm.SubItems(2).Tag = -1 '<=== and this part of code i want to subtract the text inside of the subitem(2) is
'the total minutes of timespan running.. if the timespan seconds string is 59
'then it will auto deducted the remaining minutes sample 60 minute then deduct 1
'so then remaining minutes left is 59

End If

End If


Next
End Sub

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...