What are these on the computer? Like to get SIN 45, what do I type?
ex.
(label1.caption = SIN45)
also, what are SQUAREROOT and ABS function?
Printable View
What are these on the computer? Like to get SIN 45, what do I type?
ex.
(label1.caption = SIN45)
also, what are SQUAREROOT and ABS function?
VB Code:
Private Sub Command1_Click() MsgBox (Sqr(txtSqrRoot.Text)) End Sub
Tells you the square root of the number in the text box.
VB Code:
Private Sub Command1_Click() MsgBox (Sin(45)) End Sub
Will tell you the sine of the angle.
ok thx, what about cos sin and tan?
Use the following to find the cosine of a number.
VB Code:
Private Sub Command1_Click() MsgBox (Cos(45)) ' Replace 45 with the number you want. End Sub
Use the following to the tangent of an angle.
VB Code:
Private Sub Command1_Click() MsgBox (Tan(45)) End Sub
The sin function is in my other post.
then why is this piece of code not working?
VB Code:
Line2.Y2 = 2000 - (1500 * (Sin(AngleI)))
There must be something wrong with the rest of your code (or the way you've used the formula), because i see no reason why that shouldn't do what it's supposed to. Although of course it might draw the line in a wierd place because of incorrect values.
and why is SIN in blue when I post it in the forume but not when i'm coding in my visual basic?
here, if anyone could check it out for me, thanks
It's blue here because the designers of this forum decided that sin was used often enough by people that it should be lighlighted along with keywords.
As for VB, mine doesn't highlight it either, so that doesn't matter.
Use this instead:
VB Code:
N2 = Val(Text1.Text) [b] Line2.Y2 = 2000 - (1500 * Sin(AngleI * 3.14159 / 180)) Line2.X2 = 3000 + (1500 * Cos(AngleI * 3.14159 / 180))[/b] End Sub
Sin, Cos, and Tan use radians instead of degrees so you have to multiply by Pi / 180. You'd get a very slight speed boost by making Pi / 180 a constant and using that, although it doesn't matter unless you're going to be calling this procedure exceedingly often.
Edit: ABS is Abs :)
ok thx a lot!!!!
now how do I find the refracted light? this isnt working :mad:
VB Code:
Private Sub HScroll1_Change() If Val(Text1.Text) <= 0 Then Reponse = MsgBox("Veuillez entrez un indice de refraction plus grand que 0", vbOKOnly + vbCritical, "Indice de refraction impossible") Exit Sub End If Line2.Visible = True Line3.Visible = True AngleI = HScroll1.Value N2 = Val(Text1.Text) Line2.Y2 = 2000 - (1500 * Sin(AngleI * 3.141592 / 180)) Line2.X2 = 3000 + (1500 * Cos(AngleI * 3.141592 / 180)) AngleR = (Sin(AngleI * 3.141592 / 180)) / N2 Line3.Y2 = 2000 + (1500 * Sin(AngleR * 3.141592 / 180)) Line3.X2 = 3000 - (1500 * Cos(AngleR * 3.141592 / 180)) End Sub
oh wait, I found my mistake, but now I need someone to tell me what Sin-1 is in VB!!
ArcSin(X)
VB has this great untility built into it....it's called by pressing F1 :D
Woka
funny, I don't have this great utility installed, thats why I ask.
ArcSin(X) doesn't work though
I thought you'd be aware of writing this function. I put it in your other post, which I can't find atm.Quote:
Originally posted by Alien_poo
funny, I don't have this great utility installed, thats why I ask.
ArcSin(X) doesn't work though
Inverse Sin = Atn(X / Sqr(-X * X + 1))
Inverse Cos = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
From the derived math section of MSDN (F1). There is an online collection as well: http://msdn.microsoft.com/