Monday, September 16, 2019

HOW TO CALCULATE AREA OF TRIANGLE USING VB PROGRAMMING.

Hi Friends Today i will show you how you can be Calculate Area of Triangle in VB(Visual Basic 6.0)


  • To Calculate Area of Triangle 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.
  • The Second Label for Output or Display of Calculate Area of Triangle. 
  • In this Example I used default names of Control.  
  • Also we concatenate the Strings value to show proper Output in Label Control. 

Coding of Area of Triangle

Private Sub cmdClick_Click()
Dim h As Integer, b As Integer
Dim area As Double
h = Val(Text1.Text)
b = Val(Text2.Text)
area = (0.5) * h * b
Label3.Caption = "Area of Triangle " & area
End Sub

Code Window

Output View

Design View

14 comments: