Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

displaying variable values when hovering over in debug 2

Status
Not open for further replies.

voodoojon

Technical User
Dec 18, 2003
107
GB
Hi guys,

here's a general VB question. When I am debgging code in Visual Studio, sometime when I hover my mouse above a variable in the code, a little tooltip textbox tells me its current value. Some times however, this does not show at all for any of the variables on the page.

Does anyone know why this doesn't always show?

Jon

One day I will find a signature worthy of this space. That day has not yet come.
 
Jon:

This is because the variable is not instantiated yet. Press F8 to go down to the next line of code and then hover your mouse over the variable again.

I hope this helps.



Ron Repp

If gray hair is a sign of wisdom, then I'm a genius.
 
As Ron Suggested, Life and time of the variable.

I would suggest though that you look at the immediate window and the watch window.

If you have code that looks something like this

Public Sub Something()

Dim stString as string


ststring = "Andy was here"
Thousands of other lines of code

End sub

The watch window will allow you to see the variable in the context of the watch you created and watch it change.

Also in the immediate window if you type ?stString
you will get the current value of that variable. The immediate window has many other functions as well.

Did not know if you knew about these two handy tools for looking at your variables, if you already do then great.





Andy Baldwin

"Testing is the most overlooked programming language on the books!"

Ask a great question, get a great answer. Ask a vague question, get a vague answer.
Find out how to get great answers FAQ219-2884.
 
Andy:

Great post. I often forget about the watch window.

Ron



Ron Repp

If gray hair is a sign of wisdom, then I'm a genius.
 
Your welcome. BTW We must both be genious'



Andy Baldwin

"Testing is the most overlooked programming language on the books!"

Ask a great question, get a great answer. Ask a vague question, get a vague answer.
Find out how to get great answers FAQ219-2884.
 
Another possible reason for nothing appearing is that you are hovering over an object that has no displayable default property (a recordset for example where the default property is a collection.) If the recordset hasn't been instantiated then you will see "Nothing" (i.e. the word). If it has been instantiated then you will not see anything dislayed.
 
These posts don't quite give me the answer I want, I'm afraid. I often have variable which have values in the watch window, and gives me its value when i type debug.print varName in the immediate window, but nothing when I hover over them. Typically when this happens none of the variables on the screen are giving me anything when I hover.

The reason I sent the first post in this thread is that I find it annoying to use either the immediate window or the watch list when I could be just hovering.

Jon

One day I will find a signature worthy of this space. That day has not yet come.
 
Variable values will only show up while the code is stopped, either by code, or by putting a stop in the code's left margin or when it stops on error. They won't show up when just viewing code.

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
If you are debugging code that has some sort of error, say an undefined variable, hovering over variables will not display values. Once you fix the error(s) the hovering will work again.
 
HorstDK it will work on the calculated value, before the error line

"Knowing that you know is the greatest sign of stupidity, knowing that you are ignorant is the best proof of intelligence.
 
I once had somewhat similar problem when I enabled XP appearance in VBIDE using VB6.exe.manifest file. If you are using XP appearance (as mentioned by DrJavaJoe in his third post in thread222-542249), this somehow bugs the VB's 'Auto Data Tips' feature and VB frequently shows wrong data value or no data value at all when mosue is hovered on variables in break mode.

I had to disable the XP appearance by removing the manifest file to make this feature work again correctly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top