title: I'm having difficulty calculating time differences in Visual Basic
body: <p><a href="https://i.stack.imgur.com/O90oA.png" rel="nofollow noreferrer">Layout of Calculator</a></p>
  
  <p>I am trying to build a program that calculates times differences in minutes. I do this by subtracting the start time from the finish time. I have four text boxes, two of which are for the time unit of hours (h), and the other two are for minutes (m). </p>
  
  <p><code>a</code> is the starting time in hours and <code>c</code> is the finish time in hours. They are being multiplied by 60 to convert the hours to minutes. I want to calculate the time difference between 5:40pm and 7:15pm but some how end up with 567 when the answer should be 95.</p>
  
  <p>This is not a homework task, I'm a lazy learner driver in Australia who wants to create a simple program that calculates the time of a journey in minutes.</p>
  
  <p>Can somebody please tell me what I'm doing wrong?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>Public Class Calc
      Dim Product
      Dim a, b, c, d As Integer
  
  Private Sub Enter_Click(sender As Object, e As EventArgs) Handles Enter.Click
      a = Val(TextBox1.Text) * 60
      b = Val(TextBox2.Text)
      c = Val(TextBox3.Text) * 60
      d = Val(TextBox4.Text)
      Product = (c - a + d - b)
      Time.Text = ("Driving Time: " &amp; Product)
  End Sub
  
  End Class
  </code></pre>