i want that by using on changevent a calculation can be done in vb.net windosapplication

suppose i had got some textbox like totalamount(t) , amountpaid(ap), balancerefund(bf), amount due(ad),

If t > ap Then
            bf textbox shows the amount
        Else
            ad textbox shows the amount
        End If

how to this through an on change event

Imports System

Public Class Form1
Dim totalAmnt As Decimal
Dim amountpaid As Decimal
Dim balancerefund As Decimal
Dim AmountDue As Decimal
Dim sum1 As Decimal
Dim sum2 As Decimal


Private Sub ap_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ap.TextChanged

totalAmnt = Convert.ToDecimal(ta.Text)
amountpaid = Convert.ToDecimal(ap.Text)

If totalAmnt > amountpaid Then
sum1 = totalAmnt - amountpaid
bf.Text = sum1
ad.Text = ""
Else
sum2 = amountpaid - totalAmnt
ad.Text = sum2
bf.Text = ""
End If


End Sub
End Class

This question has already been answered. Start a new discussion instead.