title: VB - Perform calculations and update results when specific value changes
body: <p>How do I calculate the amount of money one has to pay for my fictive "service" and how do I update the result while the "service-session" keeps going? </p>
  
  <p>I have four <code>TextBox</code>es:</p>
  
  <ul>
  <li>The first (<code>TextBox1</code>) contains the start time of the service-session </li>
  <li>The second (<code>TextBox2</code>) contains the duration of the session  </li>
  <li>The third (<code>TextBox3</code>) contains a fix value of <code>25.36</code> </li>
  <li>The fourth (<code>TextBox4</code>) shall display the result of the calculation</li>
  </ul>
  
  <p>When the sessions duration (value of <code>TextBox2</code>) changes, I want to update the result within <code>TextBox4</code>. For every hour the session lasts, the fixed value of 25.36 Euro (<code>TextBox3</code>) shall be added to the result. How can I achieve that?</p>
  
  <p>Here is what I tried:</p>
  
  <pre><code>Public Class Form1
  Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
      Me.Timer1.Enabled = True
      Me.TextBox1.Text = Now.ToLongTimeString.ToString()
  End Sub
  Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
      Try
          Dim StartTime As DateTime = Me.TextBox1.Text
          Dim EndTime As DateTime = Now.ToLongTimeString.ToString
          Dim TotalTime As TimeSpan = EndTime - StartTime
          Me.TextBox2.Text = (TotalTime).ToString
      Catch ex As Exception
      End Try
  End Sub
  End Class
  </code></pre>