CODE
Option Explicit
Private Sub cmdFind_Click()
Dim dblA, dblB, dblC As Double
dblA = Val(txtA.Text)
dblB = Val(txtB.Text)
dblC = Val(txtC.Text)
Call TriangleType(dblA, dblB, dblC) 'ERROR
lblArea.Caption = "The area of the triangle is " + Area(dblA, dblB, dblC)
If IsRight(dblA, dblB, dblC) Then
lblRight.Caption = "The triangle is a right triangle"
Else
lblRight.Caption = "The triangle is not a right triangle"
End If
End Sub
Private Sub TriangleType(SideA As Double, SideB As Double, SideC As Double)
If SideA = SideB And SideA = SideC Then
lblType.Caption = "The triangle is equilateral"
ElseIf Not SideA = SideB And Not SideA = SideC And Not SideB = SideC Then
lblType.Caption = "The triangle is scalene"
Else
lblType.Caption = "The triangle is isosceles"
End If
End Sub
Private Function Area(SideA As Double, SideB As Double, SideC As Double) As Double
Dim dblS As Double
dblS = (SideA + SideB + SideC) / 2
Area = (dblS * (dblS - SideA) * (dblS - SideB) * (dblS - SideC)) ^ 0.5
End Function
Private Function IsRight(SideA As Double, SideB As Double, SideC As Double) As Boolean
If SideA ^ 2 + SideB ^ 2 = SideC ^ 2 Or SideA ^ 2 + SideC ^ 2 = SideB ^ 2 Or _
SideB ^ 2 + SideC ^ 2 = SideA ^ 2 Then
IsRight = True
Else
IsRight = False
End If
End Function
For some reason, it won't let me call the TriangleType sub. Please help!!!