Sentient_667
New Member
Could someone please tell me how to convert degrees to radians in Visual Basic.NET? Any help at all would be greatly appreciated...
Students helping students, join us in improving Bored of Studies by donating and supporting future students!
Private Sub btnSin_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSin.Click
' Convert display to a double variable
Dim str As String = txtDisplay.Text
Dim num As Double = Convert.ToDouble(str)
' Convert the double variable to radians
Dim angleInRadians As Double = DegToRadians(num)
' Perform the calculation
' Display the answer
End Sub
Private Function DegToRadians(ByVal Value As Double) As Double
' Same to find the formula
I need to place the formula for converting degrees to radians in here.
End Function
Private Sub btndeg2rad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndeg2rad.Click
Dim str As String = txtDisplay.Text
Dim num As Double = str
' Convert the double variable to radians
Dim radians As Double
Dim pi As Double
pi = 3.14159265
radians = num * pi / 180
txtDisplay.Text = radians
End Sub
Private Sub btnrad2deg_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnrad2deg.Click
Dim str As String = txtDisplay.Text
Dim radians As Double = str
' Convert the double variable to radians
Dim num As Double
Dim pi As Double
pi = 3.14159265
num = radians * 180 / pi
txtDisplay.Text = num
End Sub