Solved

How to watch variables in VB6

Posted on 2003-12-07
13
1,358 Views
Last Modified: 2010-05-18
I want to watch the changes of a variable in my program. I have done an Add Watch to the variable, but cannot see the ENTIRE contents of the variable. The variable is a string with hundreds of characters. How do I view everything? The watch window limits what I can see.
0
Comment
Question by:dbnewbie
13 Comments
 

Expert Comment

by:boringnaa
ID: 9893154
hmmm why don't you write it out into text box, just temporary write some code there. It's would take so much time I think.
0
 
LVL 6

Expert Comment

by:Plamodo
ID: 9893571
I tend to use a msgbox command where I'm trying to see long strings.  It has a limit too.. but displays alot more than the watch window.
0
 

Author Comment

by:dbnewbie
ID: 9893613
The msgbox approach is what I have been doing. Unfortunately, for what I am working on, it is very impractical. There must be a better way. Isn't there a way to make that watch window shot it all?
0
 
LVL 8

Expert Comment

by:ampapa
ID: 9893674
Are you really going to be able to watch hundreds of characters? You could print to a file if you just want to verify the variable contents when your program ran...
0
 

Accepted Solution

by:
ROTRTechTeam earned 25 total points
ID: 9894092
If you are expecting a certain value and are not certain whether you are getting it or not, do a debug.assert on the variable and your program will break on that line when the expression is true.
0
 

Expert Comment

by:lonsoft
ID: 9894413
Press Ctrl+G to active "Immediate" window!
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Expert Comment

by:lonsoft
ID: 9894442
:-)

Add a "toggle breakpoint" in your form_load sub, and then run your program,
while it pause at the breakpoint, active the local windows by "View"-> "Local Windows".
0
 
LVL 2

Expert Comment

by:rekhasri
ID: 9895375
hi,

Have u trid

debug.print varname


This may give u the whole thing in the debug window...
0
 
LVL 9

Expert Comment

by:Dang123
ID: 9895819
dbnewbie,
    If you are conserned about the end of the string, and that is why you are trying to see the whole thing, use

strWatchThisString = Right$(strLongString, intCountOfImportantCharacters)

    You can use Mid if the important characters is in the middle of the large string

Dang123

0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 9896030
>>I have done an Add Watch to the variable

IF you have do that, make sure set 'Break when value changes' on watch type.

If any changes, the problem will stop and do

?variablename

 on immediate window
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 9896035
>>the problem will stop and do

the program will stop and do
0
 
LVL 13

Expert Comment

by:Michael_D
ID: 9897875
FYI
When  you pointing on your var name with mouse and holding the CTRL down you will see the end of the string in ToolTips box
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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 Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now