Text change event demo in Visual Basic 6

Download
Download is available until [expire_date]
  • Version
  • Download 107
  • File Size 2.97 KB
  • File Count 1
  • Create Date April 26, 2016
  • Last Updated April 26, 2016

Text change event demo in Visual Basic 6

Text change event demo in Visual Basic 6

This is a program in visual basic 6 that will demonstrate how the change event in textbox works.

This program will automatically compute the change based on the amount entered by the user. The change will not display or compute if the amount entered is not greater or equal to the amount that must be paid, the program will not also accept non numeric inputs.

You can use this code if you are developing applications that involves payment.

Hope this will help you.

Happy Programming!

Source code:

Private Sub cmdCancel_Click()
Unload Me
End Sub

Private Sub txtChange_Change()
If Val(txtChange.Text) < 0 Then
txtChange.Text = "0.00"
End If
End Sub

Private Sub txtPayment_Change()
txtChange = Format(Val(txtPayment.Text) - Val(txtTotalCharges), "##,##0.00")
End Sub

Private Sub txtPayment_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or KeyAscii = 46 Or KeyAscii = vbKeyBack Then
Else
   Beep
   KeyAscii = 0
End If
End Sub
, , , , ,

Post navigation

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.