I tried using the Log(x) function but it keeps giving me an error saying "expected array". i'm using a Double type variable for x. thanks for any help.
Printable View
I tried using the Log(x) function but it keeps giving me an error saying "expected array". i'm using a Double type variable for x. thanks for any help.
Try changing the variable name from x to n.
same error
Assuming you still have the Log Function (ie a type library hasn't dissapeared for some reason) the only thing I can think of is that X is the name of an array and you forgot to specify an index
for example is x declared like any of these
where a and b are numbers or constants (not variables you'd have got an error)Code:Dim x() As Double
Dim x(a) As Double
Dim x(a To b) as double
If this isn't what you've done then type "Print Math." into the debug window, you should get a picklist with Log in it somewhere, if you don't get one search your object browser for Math and Log, if you don't find the log function try reinstallin VB.
Can you post your code so we can see the whole picture please?
says "expected variable or procedure not module" when i did print math.
Dim i As Integer, j As Integer
Log = True
For i = 1 To Curves
For j = 1 To Crve(i).Num
Crve(i).Sets(j).Omega = Log(Crve(i).Sets(j).Omega)
Next j
Next i
Call DrawGraph(-1, 0, 0)
It's a graphing program, i'm trying to convert numbers from an array into log's. i tried doing it with simple non-array variables too though. by the way i searched for math and log in object browser and found both.
how does everyone post code so that it looks like code?
I see the problem, you've put Log = True for some reason at the top of your code, so VB thinks that you are using Log as a variable, then when you typ Log(x) it objects because it thinks that you want to use your Log Variable as an array and not that you want to use the Log function, get rid of the Log = True Line and it should work.
BTW you can get your code to look like code by enclosing it in Code Tags, put
[code@]
Dim i As Integer
[/code@]
but without the @ characters and it comes out
Code:Dim i As Integer
see http://forums.vb-world.net/index.php?action=bbcode for other tags
thanks, you're right
Try always to write "Option Explicit" at the beginning of each code.
This ensures the compiler that al variables must be defined with the Dim statement or within Subs, Functions, ...
You can set this as an option in the VB environment.