I have no clue, lol....I added in the * 180 / PI, but it doesn't seem to work. Maybe its just me.
This is what I have as my code:
Public Class Form1
Inherits System.Windows.Forms.Form
' General Declarations
Dim Alpha, A, B, C, R, Tan, Theta, AngleA, AngleB, AngleC, XCompA, XCompB, XCompC, YCompA, YCompB, YCompC, XCompTotal, YCompTotal As Double
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' Clear the Listbox
lstOutput.Items.Clear()
' Declarations
Dim fmtStr As String = "{0, 0} {1, 14} {2, 15}"
' Declare PI
Const PI = 3.14159265358979
' Add text to Variables
A = CDbl(Val(txtA.Text))
B = CDbl(Val(txtB.Text))
C = CDbl(Val(txtC.Text))
AngleA = CDbl(Val(txtAngleA.Text))
AngleB = CDbl(Val(txtAngleB.Text))
AngleC = CDbl(Val(txtAngleC.Text))
' Add titles to Chart/Listbox
lstOutput.Items.Add(String.Format("{0, 0} {1, 15} {2, 15}", "", "X Comp.", "Y Comp."))
' Find Cosine of Angle A...multiply by A
XCompA = FormatNumber(Math.Cos((AngleA / 180.0) * PI), 2) * A
' Find Sine of Angle A...multiply by A
YCompA = FormatNumber(Math.Sin((AngleA / 180.0) * PI), 2) * A
' Find Cosine of Angle B...multiply by B
XCompB = FormatNumber(Math.Cos((AngleB / 180.0) * PI), 2) * B
' Find Sine of Angle B...multiply by B
YCompB = FormatNumber(Math.Sin((AngleB / 180.0) * PI), 2) * B
' Find Cosine of Angle C...multiply by C
XCompC = FormatNumber(Math.Cos((AngleC / 180.0) * PI), 2) * C
' Find Sine of Angle C...multiply by C
YCompC = FormatNumber(Math.Sin((AngleC / 180.0) * PI), 2) * C
' Add all XComp and YComp's together into more variables
XCompTotal = FormatNumber(XCompA + XCompB + XCompC, 2)
YCompTotal = FormatNumber(YCompA + YCompB + YCompC, 2)
' Find "R"
R = FormatNumber(Math.Sqrt((XCompTotal ^ 2) + (YCompTotal ^ 2)), 2)
' Find "Tan"
Tan = FormatNumber((YCompTotal / XCompTotal), 2)
' Find "Theta"
Theta = FormatNumber(Math.Tan((Tan * 180.0) / PI), 2)
' Find Alpha
Alpha = FormatNumber(Math.Atan((Theta * 180.0) / PI), 2)
' Add each answer to the Listbox
With lstOutput.Items
.Add(String.Format(fmtStr, "", XCompA, YCompA))
.Add(String.Format(fmtStr, "", XCompB, YCompB))
.Add(String.Format(fmtStr, "", XCompC, YCompC))
.Add(String.Format("{0, 5} {1, 8} {2, 15}", "Total:", XCompTotal, YCompTotal))
.Add(String.Format(""))
.Add(String.Format("{0, 5} {1, 0} {2, 11}", "R =", "", R))
.Add(String.Format("{0, 0} {1, 0} {2, 1}", "Tan Alpha =", "", Tan))
.Add(String.Format("{0, 5} {1, 0} {2, 8}", "Alpha =", "", Alpha))
.Add(String.Format("{0, 5} {1, 2} {2, 4}", "Theta R =", "", Theta))
.Add(String.Format(""))
.Add(String.Format("{0, 5} {1, 0} {2, 2}", "R =", R & "N", Alpha & " Degrees"))
End With
End Sub
End Class