
Can you still remember your high school mathematics? I am sure you have learned the famous Sine Rule. Using the Sine Rule, you can compute angles and any side of the triangle if you are given enough data. The sine rule is shown in the diagram. For example, users input angle A and angle B as 60 and 30 respectively, and the length a=4, you will get an answer of b=6.93. You need to convert the degree to radian which means multiply the angle by pi(=3.14159) and divide it by 180.
The Codes
Private Sub Cal_Click()
Dim A, B, l, X, Y, d As Single
A = Val(Txt_angleA.Text)
B = Val(Txt_angleB.Text)
l = Val(Txt_sideA.Text)
X = (3.14159 / 180) * A
Y = (3.14159 / 180) * B
d = l * Sin(X) / Sin(Y)
Lbl_Answer.Caption = Str(Format(d, "0.00"))
End Sub