stage Y +1
Dim min1 As String
min1 = TextBox1.Text.Substring(0, TextBox1.Text.IndexOf(":"))
MsgBox(min1)
Dim min2 As String
min2 = TextBox2.Text.Substring(0, TextBox2.Text.IndexOf(":"))
MsgBox(ts2)
Label3.Text = CType(min2, Integer) - CType(min1, Integer)
Dim min1 As String
min1 = TextBox1.Text.Substring(TextBox1.Text.IndexOf(":"), TextBox1.Text.Length() - 1)
MsgBox(min1)
Dim min2 As String
min2 = TextBox2.Text.Substring(TextBox2.Text.IndexOf(":"), TextBox2.Text.Length() - 1)
MsgBox(min2)
Label3.Text = CType(min2, Integer) - CType(min1, Integer)
err convertion with ":"
stage Y+ 2
Imports System
Imports System.Text.RegularExpressions
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ts1 As String
ts1 = TextBox1.Text.Substring(0, TextBox1.Text.IndexOf(":"))
MsgBox(ts1)
Dim ts2 As String
ts2 = TextBox2.Text.Substring(0, TextBox2.Text.IndexOf(":"))
MsgBox(ts2)
Label3.Text = CType(ts2, Integer) - CType(ts1, Integer)
Dim min1 As String
min1 = TextBox1.Text.Substring(TextBox1.Text.IndexOf(":") + 1)
MsgBox(min1)
Dim min2 As String
min2 = TextBox2.Text.Substring(TextBox2.Text.IndexOf(":") + 1)
MsgBox(min2)
Label3.Text = CType(min2, Integer) - CType(min1, Integer)
End Sub
End Class
stage Y + 3
outputing the time dif :
Imports System
Imports System.Text.RegularExpressions
Public Class Form1
Dim Hour_sum As Integer = 0
Dim minute_sum As Integer = 0
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ts1 As String
ts1 = TextBox1.Text.Substring(0, TextBox1.Text.IndexOf(":"))
MsgBox(ts1)
Dim ts2 As String
ts2 = TextBox2.Text.Substring(0, TextBox2.Text.IndexOf(":"))
MsgBox(ts2)
Hour_sum += CType(ts2, Integer) - CType(ts1, Integer)
'Label3.Text = CType(ts2, Integer) - CType(ts1, Integer)
Dim min1 As String
min1 = TextBox1.Text.Substring(TextBox1.Text.IndexOf(":") + 1)
MsgBox(min1)
Dim min2 As String
min2 = TextBox2.Text.Substring(TextBox2.Text.IndexOf(":") + 1)
MsgBox(min2)
minute_sum += CType(min2, Integer) - CType(min1, Integer)
'Label3.Text = CType(min2, Integer) - CType(min1, Integer)
Label3.Text = Hour_sum & "hours and" & minute_sum & "minutes"
End Sub
End Class
Dim Hour_sum As Integer = 0 ' declared as global var
Hour_sum += CType(ts2, Integer) - CType(ts1, Integer)
'Label3.Text = CType(ts2, Integer) - CType(ts1, Integer)
duplicated mutation:
Dim minute_sum As Integer = 0
minute_sum += CType(min2, Integer) - CType(min1, Integer)
'Label3.Text = CType(min2, Integer) - CType(min1, Integer)
+ link :
Label3.Text = Hour_sum & "hours and" & minute_sum & "minutes"
it's only starting