Tuesday, December 11, 2007

How to work with the Calculation

How to work with the Calculation

To work with the Calculation

Step 1:

Insert the control in the form:

Step 2:

You can type in the programming codes as below to add calculation formulas to each control button:

Dim a As Integer

Dim b As Integer

Dim c As Integer

Private Sub Command1_Click()

a = Text1

b = Text2

c = a + b

Text3.Text = c

End Sub

Private Sub Command2_Click()

a = Text1

b = Text2

c = a - b

Text3.Text = c

End Sub

Private Sub Command3_Click()

a = Text1

b = Text2

c = a * b

Text3.Text = c

End Sub

Private Sub Command4_Click()

a = Text1

b = Text2

c = a / b

Text3.Text = c

End Sub


No comments: