?
Solved

How to detect unused variables?

Posted on 2000-02-15
6
Medium Priority
?
996 Views
Last Modified: 2008-03-03
Hello experts.
I have 2 questions:

1: I remember when I compile C programs using cc compiler it tells me whether I have un-used variables.

Is there a similar thing in VB?

2: I sometimes declare variables without a viariable type ie..

dim aString
dim aInt


which will set the variables to type Variant.

When i do this, it would be by mistake, is there a way to get the compiler to tell me this?


Thanks


Kaiser

0
Comment
Question by:kaiser18au
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 13

Expert Comment

by:Mirkwood
ID: 2525240
See the tools here. They are free and Project Analyzer has the feature of detecting unused variables and mismatches like your example. http://www.aivosto.com/visdev/
0
 

Author Comment

by:kaiser18au
ID: 2528991
Mirkwood:

Thanks for the answer. I checked out the website and
it was good. But the only had solutions to Q1.

If you dont mind I would like to keep this question open to see if people have suggestions for Q2.


If there is nothing else, then you could have the points.


Regards


kaiser
0
 
LVL 6

Expert Comment

by:VBGuru
ID: 2530285
Q2. There is no way a compiler can do this. Compiler will check for the syntax and as per the syntax it is a valid. So it will continue without any problem.

You can take a precaution using
DefBool DefByte DefInt DefLng DefCur
DefSng DefDbl DefDec DefDate DefStr ...

May be you cam write an add-in to check for these kind of declarations
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 6

Expert Comment

by:VBGuru
ID: 2530286
Q2. There is no way a compiler can do this. Compiler will check for the syntax and as per the syntax it is a valid. So it will continue without any problem.

You can take a precaution using
DefBool DefByte DefInt DefLng DefCur
DefSng DefDbl DefDec DefDate DefStr ...

May be you cam write an add-in to check for these kind of declarations
0
 

Author Comment

by:kaiser18au
ID: 2532848
Mirkwood:

Sorry about that, that websites software did have that feature.

If you want to put in another answer, then I can forward you the points.

It was just a feature that was hidden, you had to pop up the options thats all.

Thaks again.

kaiser
0
 
LVL 13

Accepted Solution

by:
Mirkwood earned 80 total points
ID: 2537059
Ok, thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month12 days, 6 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question