?
Solved

How to watch variables in VB6

Posted on 2003-12-07
13
Medium Priority
?
1,367 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 100 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month10 days, 14 hours left to enroll

770 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