Solved

How to watch variables in VB6

Posted on 2003-12-07
13
1,365 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
[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
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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
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
 

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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code 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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

717 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