CALCULATIONS

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Please help. simple code required.

Word document

I would like three text boxes linked so as the final txtbox displays the
answer from the first two which have been multiplied, or if this is not
possible can anyone help with a solution.
 
I would like three text boxes linked so as the final txtbox displays the
answer from the first two which have been multiplied, or if this is not
possible can anyone help with a solution.

\\\
Imports System.Globalization
..
..
..
Private Sub Button1_Click( _
ByVal sender As Object, _
ByVal e As EventArgs _
) Handles Button1.Click
Dim d1, d2, r As Double
Dim Err As Boolean
Dim ErrorMessage As String
Const DoubleErrorMessage As String = _
"Enter a value that can be represented in a double."
If Not d1.TryParse(Me.TextBox1.Text, NumberStyles.Any, Nothing, d1) Then
ErrorMessage = DoubleErrorMessage
Err = True
End If
Me.ErrorProvider1.SetError(Me.TextBox1, ErrorMessage)
ErrorMessage = ""
If Not d2.TryParse(Me.TextBox2.Text, NumberStyles.Any, Nothing, d2) Then
ErrorMessage = DoubleErrorMessage
Err = True
End If
Me.ErrorProvider1.SetError(Me.TextBox2, ErrorMessage)
If Not Err Then
r = d1 * d2
Me.TextBox3.Text = CStr(r)
End If
End Sub
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top