Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
ASP.NET
VB.Net
C-Sharp
SQL Server
 

Get angle of sine cosine tangent values using Math class in VB and C#.net 2.0

Author: Maliha Atteeq
Download Source Code : 968_Math.zip

In this simple article you will learn that how we can get angle of sine, cosine and tangent values using "Math class" in VB and C# (.net 2.0).

 Angle of Sine value:

To get the angle of sine value we have static function of class Math named Asin (). This function takes value as double type value in parameter and returns double value which is the angle of that value.

To demonstrate make a window application. Drag one text box and one button on form.

Now write the following code on Button click event:

C#

private void btn_sin_Click(object sender, EventArgs e)

        {

            string str = txt_sin.Text;

            double value = Convert.ToDouble(str);

            double angle;

            angle = System.Math.Asin(value);

            MessageBox.Show(angle.ToString());

        }

VB

Private Sub btn_sin_Click(ByVal sender As Object, ByVal e As EventArgs)

        Dim str As String = txt_sin.Text

        Dim value As Double = Convert.ToDouble(str)

        Dim angle As Double

        angle = System.Math.Asin(value)

        MessageBox.Show(angle.ToString())

    End Sub

This is simple code to get the angle of sine value.

Angle of Cosine value:

To get the angle of cosine value we have static function of class Math named Acos (). This function takes value as double type value in parameter and returns double value which is the angle of that value.

To demonstrate make a window application. Drag one text box and one button on form.

Now write the following code on Button click event:

C#

private void btn_cos_Click(object sender, EventArgs e)

        {

            string str = txt_cos.Text;

            double value = Convert.ToDouble(str);

            double angle;

            angle = System.Math.Acos(value);

            MessageBox.Show(angle.ToString());

        }

VB

Private Sub btn_cos_Click(ByVal sender As Object, ByVal e As EventArgs)

        Dim str As String = txt_cos.Text

        Dim value As Double = Convert.ToDouble(str)

        Dim angle As Double

        angle = System.Math.Acos(value)

        MessageBox.Show(angle.ToString())

    End Sub

This is simple code to get the angle of cosine value.

Angle of Tangent value:

To get the angle of tangent value we have static function of class Math named Atan (). This function takes value as double type value in parameter and returns double value which is the angle of that value.

To demonstrate make a window application. Drag one text box and one button on form.

Now write the following code on Button click event:

C#

private void btn_tan_Click(object sender, EventArgs e)

        {

            string str = txt_tan.Text;

            double value = Convert.ToDouble(str);

            double angle;

            angle = System.Math.Atan(value);

            MessageBox.Show(angle.ToString());

        }

VB

Private Sub btn_tan_Click(ByVal sender As Object, ByVal e As EventArgs)

        Dim str As String = txt_tan.Text

        Dim value As Double = Convert.ToDouble(str)

        Dim angle As Double

        angle = System.Math.Atan(value)

        MessageBox.Show(angle.ToString())

    End Sub

This is simple code to get the angle of tangent value.

Tangent of two values quotient:

To get the angle of tangent value of quotient of two values we have static function of class Math named Atan2 (). This function takes two values as double type value in parameter and returns double value which is the angle of that value.

To demonstrate make a window application. Drag two text box and one button on form.

Now write the following code on Button click event:

C#

        private void btn_tavquotn_Click(object sender, EventArgs e)

        {

            string str = txt_one.Text;

            string str2 = txt_two.Text;

            double angle;

            double one = Convert.ToDouble(str);

            double two = Convert.ToDouble(str2);

            angle = System.Math.Atan2(one, two);

            MessageBox.Show(angle.ToString());

        }

VB

Private Sub btn_tavquotn_Click(ByVal sender As Object, ByVal e As EventArgs)

        Dim str As String = txt_one.Text

        Dim str2 As String = txt_two.Text

        Dim angle As Double

        Dim one As Double = Convert.ToDouble(str)

        Dim two As Double = Convert.ToDouble(str2)

        angle = System.Math.Atan2(one, two)

        MessageBox.Show(angle.ToString())

    End Sub

Now write the following code on FORM LOAD event:

C#

private void Form1_Load(object sender, EventArgs e)

        {

            this.Text = "DEVASP MATH APPLICATION";          

        }

VB

Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)

        Me.Text = "DEVASP MATH APPLICATION"

    End Sub

This simple article tells that how we can get angle of sine, cosine and tangent values using "Math class" in VB and C# (.net 2.0).

   
Add Article Comment:
Name :
Email Address :
   
Comments :
 
   
<< Get sine cosine tangent hyperbolic sine cosine tangent values of angle using "Math class" VB and C#.net 2.0

Disclaimer - Privacy
© 2002-2017 DevASP.net