• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 165
  • Last Modified:

Track Changes to a variable

how do i track the changes made to a variable... i want to know what is changing the varaible and where in code it is located.  
1 Solution

I don't know if this looks practical but if you replace your variable by an object and implemenet some code for that class so it can keep track of previous changes, that might solve your problem.

A class like this emulating a string variable would be something like:

    Class StringTrack
        Dim sValue As String
        Public Property Value() As String
                Return sValue
            End Get
            Set(ByVal Value As String)
                sValue = Value
            End Set
        End Property
    End Class

And you use it like:

        Dim sTrack As New StringTrack
        sTrack.Value = "HELLO"
        sRead = sTrack.Value

And/or you can create a method called like SetValue that accepts additional parameters that provide details you can save in your internal track log for further analysis.

You could add the variable to a watch (right the variable, choose quickwatch, choose add watch), and use this together with the call stack window to trace the changes made to the variabele
BangorCCAuthor Commented:
not quite what i was looking for but it works
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now