Wiki Link: [discussion:3874]
Auto Calculate/Auto Populate 

Aug 31 2010 at 6:49 PM
I have been working on a program for my work. Right now they are using Excel and saving each instance of their changes and I want to change that so that the INformation goes into a database instead.
I've created the database with all the required fields and relationships. I've created the form in VB2008 express. Now, for aesthetic purposes, I want to create a couple for fields that add up the preceding fields. The only problem that I have though is that it won't auto calculate. In order for the calculation to occur I have to add a "calculate" button that adds up the fields requested once the information has been inputted.
So, my question is, is there anyway to have the "Totals" fields to autocalculate as they are being input? I am using a Label for my TOTALS fields, although, i have also tried using a Textbox without any success either.

For the button click code I have been using:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim num1, num2, num3, num4, num5, num6, num7, num8, sum As Single
num1 = BDepositTextBox.Text
num2 = ChargesTextBox.Text
num3 = DebitsTextBox.Text
num4 = CCTextBox.Text
num5 = CouponsTextBox.Text
num6 = Gift_CertificatesTextBox.Text
num7 = ROATextBox.Text
num8 = Deposit_ErrorTextBox.Text
sum = num1 + num2 + num3 + num4 + num5 + num6 + num7 + num8
Label13.Text = sum
End Sub

Thank you for any help you can provide.


Updating...
Page view tracker