Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim r, d As Double Const Pi = 3.141596 r = Val(rtb.Text) d = Val(dtb.Text) If 0 < d < 360 Then r = d / 180 * Pi rtb.Text = Format(r, "0.00") dtb.Text = Format(d, "0.00") ElseIf 0 < r < Pi Then d = r / Pi * 180 dtb.Text = Format(d, "0.00") rtb.Text = Format(r, "0.00") End If End Sub
Above is my code for my little converter for Radian-Degree or vice versa, and I'm only a newbie who still learning basics for Visual Basic.
My problem is, When I debug the program it seems like the code is only work when the degree is going to convert to radian but my radian cannot convert to degree. And when I reverse both arguments the radian in working to be converted to degree but degree is not going to be converted into radian.
I would like to know where is my problem, Thanks.