"cmdolcet69" <colin_dolcetti@hotmail.com> schrieb
On Feb 29, 3:04 pm, "Armin Zingler" <az.nos...@freenet.de> wrote:
> > > "cmdolcet69" <colin_dolce...@hotmail.com> schrieb
> > > > Let me know if that's what you are looking for.
[quoted text clipped - 21 lines]
> the vairables it will say they are not delcared, how can i declare
> them?
I give you an example:
Sub Example()
Dim result As Double
Dim Input As String
Dim InputValue As Double
'first example
result = Math.Sin(17)
MsgBox(result)
'second example
Input = InputBox("Please enter a value")
InputValue = CDbl(Input)
result = Math.Sin(InputValue)
MsgBox(result)
'third example
result = Math.Sin(InputValue + 17)
MsgBox(result)
End Sub
In this case, Math.Sin is the function. The function has one argument.
The name of the argument does not matter. As you see above, you can pass
any value to the function. In the first call it is an integer literal,
in the second call, the value is taken from variable 'InputValue', and
it's the result of an expression in the third example.
The code that the compiler creates for the line "result =
Math.Sin(InputValue)" is:
1. Take the value stored in variable 'InputValue'
2. Push the value onto the stack
3. Call Math.Sin
4. Store the return value in variable 'result'.
Inside Math.Sin, the code can access the value that has been put on the
stack in step two by the name of the argument. The function does not
know where the value came from. The value can be an integer literal (17
in this example), it can be the content of a variable (second example)
or it can be the result of a (sometimes complex) expression like in
example three.
So, I can not answer your individual question. You have to know where
you get the values from on your own. Imagine I ask you "Where do I get
the argument value for calling Math.Sin"?. You can not answer this, just
like I can not answer where you get the values for calling your
function. It depends on what you want to do.
Armin