Posted: Tue May 24, 2011 2:34 pm Post subject: RE:sin button doesnt work
I have two suggestions however I do not know how well either will work, sometimes there's a rounding error when dividing ints and doubles, try dividing by 180.0 instead.
Also I noticed you have brackets around your calculation, I think VB implicitly casts, but just to be sure why not explicitly cast the calculation to string
z_cross_fire
Posted: Tue May 24, 2011 8:56 pm Post subject: Re: sin button doesnt work
pari @ Tue May 24, 2011 1:30 pm wrote:
can someone help me wit my sin button
this what i tried:
VisualBASIC:
PrivateSub cmdSin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSin.Click
num1 = Double.Parse(txtC.Text)
txtC.Text = " "
op = "sin"
txtC.Text = (Math.Sin(num1) * Math.PI / 180)
The last line should instead be:
VisualBASIC:
txtC.Text = Math.Sin(num1 * Math.PI / 180)
The angle must be converted to radians BEFORE using it in the Math.Sin(x) function.