In this post we have learned about auto sum Textbox. How can we sum the textbox data into totals. As we have number, price, total amount. For this we need three textboxes from the toolbox. After that we have to use below coding as per video instruction. This option will come in handy when we need to invoice for any data. And used in database software etc.
Public Class Form1
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
If TextBox1.Text = "" Or TextBox2.Text = "" Then
Else
Dim num21 As Double = TextBox1.Text
Dim num22 As Double = TextBox2.Text
Dim ans As Double = num21 * num22
TextBox3.Text = (FormatNumber(ans))
End If
End Sub
Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
If TextBox1.Text = "" Or TextBox2.Text = "" Then
Else
Dim num13 As Double = TextBox2.Text
Dim num14 As Double = TextBox1.Text
Dim ans As Double = num13 * num14
TextBox3.Text = (FormatNumber(ans))
End If
If TextBox1.Text = "" Then
TextBox3.Text = ""
TextBox2.Text = ""
Else
End If
End Sub
End Class