Results 1 to 5 of 5

Thread: Searching for unused variables

  1. #1

    Thread Starter
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    Before I write one myself....

    Does anyone know of an AddIn which searches through [VB5] source code and lists unused or duplicated variables?



    ------------------
    Mark Sreeves
    Analyst Programmer

    [email protected]
    A BMW Group Company

  2. #2
    Member
    Join Date
    Jul 1999
    Posts
    40

    Post

    If you use Option Explict at the head of your code you can't have duplictate variables....so that is one way of finding duplicates...when you recompile it will point them out.

  3. #3

    Thread Starter
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    You CAN have duplicates!

    by which I mean two variables of with the same name in scope at once.

    try this:
    Code:
    Option Explicit
    Dim x As Integer
    Private Sub Form_Load()
    x = 1
    End Sub
    
    Private Sub Command1_Click()
    Dim x As Integer
    x = 2
    MsgBox x
    End Sub


    ------------------
    Mark Sreeves
    Analyst Programmer

    [email protected]
    A BMW Group Company

  4. #4
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    I don't know if there's any Add-In for this, but you are right, you can write one yourself.

    ------------------

    Serge

    Software Developer
    [email protected]
    [email protected]
    ICQ#: 51055819


  5. #5

    Thread Starter
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    Thanks for that serge

    ------------------
    Mark Sreeves
    Analyst Programmer

    [email protected]
    A BMW Group Company

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width