Hi Friends Today i will show you how you can be Calculate Percentage in VB(Visual Basic 6.0)
- To Make An Calculator you need to insert Two Label Control's.
- And another Control's need to insert is Two Text box Control.
- One Command button is placed to the form.
- As Shown in Picture Arrange it.
- Also Placed Another Label for Output or Display of Calculation of Percentages.
- In this Example I used default names of Control.
Coding of Percentages
Private Sub cmdClick_Click()
Dim obt As Integer, tol As Integer
Dim per As Double
obt = Val(txtOtd.Text)
tol = Val(txtTol.Text)
per = obt * 100 / tol
Label3.Caption = "Percentage are " & per
End Sub
Dim obt As Integer, tol As Integer
Dim per As Double
obt = Val(txtOtd.Text)
tol = Val(txtTol.Text)
per = obt * 100 / tol
Label3.Caption = "Percentage are " & per
End Sub
Code Window |
Output View |
Design View |
No comments:
Post a Comment