Shane Partridge
Visual Basic 2013
The Code
Public Class Form28
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Form25.Show()
Me.Hide()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim numbersides, Inanglesum, Exanglesum, interiorsum, exteriorsum, TotalSumAngle As Double
Dim n As String = "n2"
numbersides = TextBox1.Text 'Input No. Sides into TextBox1
Inanglesum = ((Val(TextBox1.Text) - 2) * 180) 'Formula Interior (Sum)Polygon Calculation
Exanglesum = (180 - (Inanglesum / numbersides)) 'Formula Exterior (1) Polygon Angle Calculations
interiorsum = (Inanglesum / TextBox1.Text) 'Formula Interior (1) Polygon Angle Calculations
exteriorsum = (Exanglesum * numbersides) 'Formula Exterior (Sum) Polygon Calculations
TotalSumAngle = (interiorsum + Exanglesum)
'Interior Calculations
Label1.Text = Inanglesum.ToString(n) 'Label1 = Total Sum Interior Angles
Label2.Text = interiorsum.ToString(n) 'Label2 = Value of (1) Exterior Angle
Label3.Text = numbersides.ToString(n) 'Label3 = No. of Polygon Sides
'Exterior Calculations
Label4.Text = exteriorsum.ToString(n) 'Label4 = Exterior Sum of Angles
Label5.Text = Exanglesum.ToString(n) 'Label5 = [1] Exterior anglesum
Label6.Text = numbersides.ToString(n) 'Label6 = No. of Polygon Sides
Label7.Text = TotalSumAngle.ToString(n) 'Label7 = Sum of Interior & Exterior Angles
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
'Clear all Variables
TextBox1.Text = ""
Label1.Text = ""
Label2.Text = ""
Label3.Text = ""
Label4.Text = ""
Label5.Text = ""
Label6.Text = ""
End Sub
End Class