Hello,

I have written a program that uses trig functions and the results are in Radians. I would like to show the results in Degrees and have found a Method named RadianToDegree but am having difficulty applying it.

Can someone offer help with this, or perhaps a different way to accomplish what I need??

Thanks,

Jim

Yes, thanks for that. I am quite familiar with the formula. I am very new to programming and trying to learn the ins-and-outs of using the many built in solutions for problem solving.

The program I am writing will have many instances of trig functions and therefore will require many instances of converting if I apply the formula. Instead I was hoping for some built in function that would universally do the conversion for me.

Thanks,

Jim

k, you said that you're having trouble applying a function you've already found. If you post the code that uses it, I can try to help out on that end. I don't think there's a function that does this built into .NET, but it's trivial to write.

As Inanna says:

Imports System.Math

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        TextBox1.Text = CStr(RadianToDegree(Sin(0.2345)))
    End Sub

    Public Function RadianToDegree(ByVal radians As Single) As Single
        Return radians * 180.0 / PI
    End Function

End Class

Thanks Wayne - That's pretty much the way I'm trying to use RadianToDegree, but whenever I try to apply it to my program it gets a blue underline with a statement saying

Name 'RadianToDegree' is not declared.

I'm too new to this to fully understand how to deal with that message.

Jim

You aren't defining the function or it's not visible from where you're calling it. Make sure that the function actually exists and that you're spelling the name right. That's usually my problem. :)

This article has been dead for over six months. Start a new discussion instead.