VB Code:
Private Function TimeDifferenceInMins(ByVal intHours As Integer, ByVal intMinutes As Integer, ByVal intHours2 As Integer, ByVal intMinutes2 As Integer) As Integer
Dim MinIn1 As Integer = MinutesIn(intHours, intMinutes)
Dim MinIn2 As Integer = MinutesIn(intHours2, intMinutes2)
' Return MinIn1 - MinIn2 = intTimeDiff : This line is problematic.
' It returns the result of the comparison between MinIn1 - MinIn2 and intTimeDiff as an integer,
' when false it returns 0 and when true it returns -1
' So you need to return just MinIn1 - MinIn2 , so it should be
Return MinIn1 - MinIn2
End Function
The second one is:
VB Code:
Private Function MinutesIn(ByVal intHours As Integer, ByVal intMinutes As Integer) As Integer
Dim MinIn1 As Integer
Try
MinIn1 = (intHours * 60) + intMinutes
Return MinIn1
Catch ex As Exception
MsgBox("An Error Has Occurred: " & ex.Message, MsgBoxStyle.Information, "Time time time")
End Try
'Dim MinIn2 As Integer
'Try
' MinIn2 = (intHours * 60) + intMinutes
' Return MinIn2
'Catch ex As Exception
' MsgBox("An Error Has Occurred: " & ex.Message, MsgBoxStyle.Information, "Time time time")
'End Try
End Function
The commented part is not needed at all.