|
-
Aug 21st, 2008, 09:34 AM
#1
Thread Starter
Member
[RESOLVED] Undeclared Variables (?!Grrrr)
I'm updating some spaghetti that consistently uses an undeclared
variable that I guess (based on context) is supposed to be interpreted as a String. The code both compiles and executes successfully.
How is this possible?
Tara, Curmudgeon-at-Large, Engineer in Spare Time
-
Aug 21st, 2008, 09:38 AM
#2
Re: Undeclared Variables (?!Grrrr)
It is probably being considered a Variant.
Are you going through and predeclaring them as they should be?
-
Aug 21st, 2008, 09:42 AM
#3
Thread Starter
Member
Re: Undeclared Variables (?!Grrrr)
 Originally Posted by Hack
It is probably being considered a Variant.
Are you going through and predeclaring them as they should be?
Not sure what a Variant is. And I am predeclaring as I add new code to this
already existent disaster that got dropped in my lap.
So what is a Variant? (I'm new to VB...this forum and the MSDN website
are my only available references.)
Thanks.
Tara, Curmudgeon-at-Large, Engineer in Spare Time
-
Aug 21st, 2008, 09:43 AM
#4
Re: Undeclared Variables (?!Grrrr)
-
Aug 21st, 2008, 09:45 AM
#5
Thread Starter
Member
Re: Undeclared Variables (?!Grrrr)
So if I'm reading this properly, it is indeed possible to not declare
a variable and then VB assumes it's a variant?
P.S. - coming from someone who's done a lot of Ada, C++ and some Java
isn't this kind of bad practice?
Tara, Curmudgeon-at-Large, Engineer in Spare Time
-
Aug 21st, 2008, 09:48 AM
#6
Re: Undeclared Variables (?!Grrrr)
That would depend on how the IDE is set up. The norm would be to have the compiler (and the IDE) insist that all variables are declared before being used.
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
Aug 21st, 2008, 09:53 AM
#7
Re: Undeclared Variables (?!Grrrr)
 Originally Posted by tlwtheq
So if I'm reading this properly, it is indeed possible to not declare
a variable and then VB assumes it's a variant?
P.S. - coming from someone who's done a lot of Ada, C++ and some Java
isn't this kind of bad practice?
Yes.... For some reason MS developers thought it would be handy to have VB default to not declaring variables unless Option Explicit is declared. Go figure!
<--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
If topic has been resolved, please pull down the Thread Tools & mark it Resolved.
Is VB consuming your life, and is that a bad thing?? 
-
Aug 21st, 2008, 09:55 AM
#8
Thread Starter
Member
Re: Undeclared Variables (?!Grrrr)
 Originally Posted by CDRIVE
Yes.... For some reason MS developers thought it would be handy to have VB default to not declaring variables unless Option Explicit is declared. Go figure!
Ahhh, MS developers. That explains a lot.
Thanks everyone.
Tara, Curmudgeon-at-Large, Engineer in Spare Time
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
|