431,943 Members | 1,921 Online
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,943 IT Pros & Developers. It's quick & easy.

# How to set 0,1 as 0.1 on Sine and Cos function ?

 P: 3 Hello, When I use the Math.Cos and Math.Sin function I get wrong result because it get the value as 0,1 instead of 0.1. Here is an example 14,9896229 * sin(0,525) = 14 14,9896229 * cos(0,525) = 0 (those values are imputed automatically) BUT 14.9896229 * sin (0.525) = 12,9708795712695 14.9896229 * cos(0.525) = 7,51299393263617 (those values I edited then manually while running the program) Here is my code : Expand|Select|Wrap|Line Numbers Public Class AdUL       Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _  Handles TextBox1.TextChanged           TextBox3.Text = Val(TextBox1.Text) * 299792458 * 0.00000001         TextBox4.Text = Val(TextBox2.Text) * (Math.PI / 180)       End Sub       Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _  Handles TextBox2.TextChanged           TextBox3.Text = Val(TextBox1.Text) * 299792458 * 0.00000001         TextBox4.Text = Val(TextBox2.Text) * (Math.PI / 180)       End Sub       Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _  Handles TextBox3.TextChanged           Dim R As Decimal = Val(TextBox3.Text)         Dim a As Decimal = Val(TextBox4.Text)         TextBox5.Text = R * Math.Cos(a)         TextBox6.Text = R * Math.Sin(a)       End Sub       Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _      Handles TextBox4.TextChanged           Dim R As Decimal = Val(TextBox3.Text)         Dim a As Decimal = Val(TextBox4.Text)         TextBox5.Text = R * Math.Cos(a)         TextBox6.Text = R * Math.Sin(a)       End Sub     End Class Note: I changed the decimal, interger, single and may more ... I get the same result ... Note2: I use Visual Basic from Visual Studio 2008 Note3: I need results like the second example Can some help me ? Thank you Apr 27 '15 #1