|
-
Aug 23rd, 2000, 10:07 AM
#1
Thread Starter
Junior Member
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.
-
Aug 23rd, 2000, 10:11 AM
#2
Fanatic Member
Try changing the variable name from x to n.
-
Aug 23rd, 2000, 10:13 AM
#3
Thread Starter
Junior Member
-
Aug 23rd, 2000, 10:15 AM
#4
Frenzied Member
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
Code:
Dim x() As Double
Dim x(a) As Double
Dim x(a To b) as double
where a and b are numbers or constants (not variables you'd have got an error)
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.
-
Aug 23rd, 2000, 10:16 AM
#5
Frenzied Member
Can you post your code so we can see the whole picture please?
-
Aug 23rd, 2000, 10:18 AM
#6
Thread Starter
Junior Member
says "expected variable or procedure not module" when i did print math.
-
Aug 23rd, 2000, 10:21 AM
#7
Thread Starter
Junior Member
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.
-
Aug 23rd, 2000, 10:23 AM
#8
Thread Starter
Junior Member
how does everyone post code so that it looks like code?
-
Aug 23rd, 2000, 10:34 AM
#9
Frenzied Member
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
see http://forums.vb-world.net/index.php?action=bbcode for other tags
-
Aug 23rd, 2000, 10:45 AM
#10
Thread Starter
Junior Member
-
Aug 23rd, 2000, 01:49 PM
#11
Fanatic Member
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|