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

Recommended Answers

All 3 Replies

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

thanks***************************

anuj6928

it works properly

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.