Results 1 to 10 of 10

Thread: [RESOLVED] Debug.Print not showing in Immediate window

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2013
    Location
    San Francisco, CA
    Posts
    528

    Resolved [RESOLVED] Debug.Print not showing in Immediate window

    I can't seem to figure out why the results of my Debug.Print statements don't appear in the Immediate window when I'm in Debug mode (single stepping through my code after compiling to the /Bin/Debug folder).

    This should be simple, but I need some help. Appreciate any help on how to do this.

  2. #2
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,598

    Re: Debug.Print not showing in Immediate window

    They go to the Output Window, by default.
    If you want them to go to the Immediate Window, you have to choose that option. Probably from the Tools/Option/Debugging menu, but I'll have to track down exactly where. You might find it before me.

    5 minutes later (had to launch the IDE): It's about the 7th option from the bottom of the list on the Tools/Options/Debugging/General list.
    "Redirect all Output Window text to the Immediate Window".

    But if you like to type things into your Immediate Window to examine and try things out, you might not want other debugging output going to that window as well, so keeping the rest of the Output stuff going to the Output window is usually desirable.
    Last edited by passel; Aug 17th, 2016 at 12:46 PM.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2013
    Location
    San Francisco, CA
    Posts
    528

    Re: Debug.Print not showing in Immediate window

    Hi passel -

    Yes, my IDE has that option already checked. There must be something else that I'm missing. Thoughts?...

  4. #4
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,598

    Re: Debug.Print not showing in Immediate window

    Have you verified that it is still going to the Output window, or is it Lost?
    At the top of the Output window there is a selection of what Output your seeing, e.g. Build or Debug. Is Debug selected.
    Changing the option I mentioned in post #2 seems to be an involved reconfiguration of the IDE, as it can appear to hang for some number of seconds when switching the option.
    I guess I would try deselecting the redirect output option, wait for the IDE to reconfigure itself (might take 10 seconds or so), and then run a program to verify if Debug.Print and/or Debug.WriteLine writes to the Output window.
    Then try checking the option to redirect to the immediate window again and wait as it reconfigures, then run and test to see if it now goes to the immediate window or still goes to the output window, or is lost altogether.

  5. #5
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,508

    Re: Debug.Print not showing in Immediate window

    They go to the Output Window, by default.
    Debug.Print has always gone to my Immediate window by Default, versions 2003, 2005, 2010. Maybe it's different in the newer versions but I've never had to set that Option.

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Debug.Print not showing in Immediate window

    Quote Originally Posted by wes4dbt View Post
    Debug.Print has always gone to my Immediate window by Default, versions 2003, 2005, 2010. Maybe it's different in the newer versions but I've never had to set that Option.
    It might depend on the way you set up your IDE. It may be that it is different between choosing VB Developer and General Developer when you first run VS. I've always seen Debug output in the Output window and I always choose General Developer.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2013
    Location
    San Francisco, CA
    Posts
    528

    Re: Debug.Print not showing in Immediate window

    Found the answer . In the "Compile" section of my project properties there is an "Advanced Compile Options..." button. Clicking this button opens the "Advanced Compiler Settings" window. In this window there is a "Compilation Constants" section that has a "Define DEBUG constant" checkbox.

    Name:  8-20-2016 10-19-48 AM.jpg
Views: 17490
Size:  37.0 KB

    I did not have this checkbox checked. When it is checked, then my Debug.Print statements output to the Immediate window of the IDE.

  8. #8
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [RESOLVED] Debug.Print not showing in Immediate window

    What build configuration are you running? That DEBUG constant is defined by default for Debug but not for Release. You're not running a Release build in the debugger are you? It's generally bad form to define the DEBUG constant for the Release configuration because it makes your released executable less efficient.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2013
    Location
    San Francisco, CA
    Posts
    528

    Re: [RESOLVED] Debug.Print not showing in Immediate window

    My Release build configuration does not have the "Define DEBUG constant" checked.

    I don't know why it was unchecked in my Debug build configuration.

    Visual Studio has a lot of configuration parameters. I admittedly am not an expert on most of them .

    Now, if I could just figure out why I have to delete my Bin folder between compiling my code (to avoid the "cannot copy the .exe file from obj\x86\Debug folder to \bin folder" error)...but that's for another day and other postings:

    http://www.vbforums.com/showthread.p...+%5Cbin+folder

    http://www.vbforums.com/showthread.p...t=#post5018697

    http://www.vbforums.com/showthread.p...community+2015
    Last edited by Mark@SF; Aug 21st, 2016 at 11:24 AM.

  10. #10
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,508

    Re: [RESOLVED] Debug.Print not showing in Immediate window

    Code:
    Now, if I could just figure out why I have to delete my Bin folder between compiling my code (to avoid the "cannot copy the .exe file from obj\x86\Debug folder to \bin folder" error)...but that's for another day and other postings:
    I see you have a link to my post on this subject. Unfortunately I've never been able to solve the problem, I hope you have better luck. You might try creating a new project and add your code using "Add Existing Item". If your project isn't huge, it shouldn't take long. A better than closing and restarting the project each time you want to compile.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width