• Welcome to Valhalla Legends Archive.
 

VB unsigned data types?

Started by FuZe, August 02, 2003, 03:10 PM

Previous topic - Next topic

Adron

Try a form with two text boxes, two labels, and this code:


Option Explicit

Private Sub Text1_Change()
 On Error GoTo adderr
 Label1 = CLng(Text1) + CLng(Text2)
domul:
 On Error GoTo mulerr
 Label2 = CLng(Text1) * CLng(Text2)
 Exit Sub
adderr:
 Label1 = "Error"
 Resume domul
mulerr:
 Label2 = "Error"
End Sub

Private Sub Text2_Change()
 On Error GoTo adderr
 Label1 = CLng(Text1) + CLng(Text2)
domul:
 On Error GoTo mulerr
 Label2 = CLng(Text1) * CLng(Text2)
 Exit Sub
adderr:
 Label1 = "Error"
 Resume domul
mulerr:
 Label2 = "Error"
End Sub