So I have 2 labels that the times change I need to add them together they do not stay the same but I cant find a ways to get them to add right. Here is what I have.
Dim Time1, Time2 As String
Dim TotalTime As Integer
'The Time that is in Lable is in Hours and Mins.
'Example 0:13 is 13 Mins
'Example 1:45 is 1 Hour and 45 mins
Time1 = Convert.ToInt32(lblTime1)
Time2 = Convert.ToInt32(lblTime2)
TotalTime = Time1 + Time2
End Sub
Parse TimeSpan
s out of your labels’ Text
s:
Dim time1 = TimeSpan.ParseExact(lblTime1.Text, "h\:mm", CultureInfo.CurrentCulture)
Dim time2 = TimeSpan.ParseExact(lblTime2.Text, "h\:mm", CultureInfo.CurrentCulture)
Dim totalTime = time1 + time2
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments