Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Global Arrays?

Author
Message
Xlaydos
20
Years of Service
User Offline
Joined: 26th Mar 2004
Location:
Posted: 23rd Feb 2007 16:21 Edited at: 23rd Feb 2007 16:23
How do i make an array global? I think that is the source of this error message


Here is my code:



Search button isnt working for me so sorry if its already been asked
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 23rd Feb 2007 16:32
iirc arrays defined in a function are scoped to the function only. define the array in the main code somewhere (usually near top)

London 7/7/05 = 1 in 10^38 Alex Jones: Terror Storm
Ron Paul '08
Xlaydos
20
Years of Service
User Offline
Joined: 26th Mar 2004
Location:
Posted: 23rd Feb 2007 16:35
Still gives the same error :S
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 23rd Feb 2007 20:23
Your dim is called items but accessing using item

Boo!
Xlaydos
20
Years of Service
User Offline
Joined: 26th Mar 2004
Location:
Posted: 23rd Feb 2007 20:46
Argh lol

Stupid $ looks like s

Sorry guys

Thanks a lot spooky
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 24th Feb 2007 00:30
you can get rid of the silly $ and # symbols by using the AS clause and bit of notation cant hurt, like:

DIM strItems() As String
DIM fltSomeVar() As Float

works for singular variables as well

strName As String
intID As Integer
fltPosX As Float

etc

notation need not be three letters, you can shorten to one (s,f,i etc)

London 7/7/05 = 1 in 10^38 Alex Jones: Terror Storm
Ron Paul '08
Xlaydos
20
Years of Service
User Offline
Joined: 26th Mar 2004
Location:
Posted: 25th Feb 2007 19:10
Thanks, i'll probably use that

Login to post a reply

Server time is: 2024-11-26 00:32:57
Your offset time is: 2024-11-26 00:32:57