Clear Output/Debug window?

Discussion in 'Microsoft C# .NET' started by Bob, Mar 22, 2007.

  1. Bob

    Bob Guest

    Does anyone know how to clear the window so it's easier to see the
    stuff you have listed with Debug.Write(xyz)?

    Bob Sweeney
     
    Bob, Mar 22, 2007
    #1
    1. Advertisements

  2. Bob

    Guest Guest

    Guest, Mar 22, 2007
    #2
    1. Advertisements

  3. Bob

    Bob Guest

    On Mar 22, 12:21 pm, Peter Bromberg [C# MVP]
    <> wrote:
    > Try right-clicking inside the Output window and look at the context menu
    > options.
    > Peter
    > --
    > Site: http://www.eggheadcafe.com
    > UnBlog: http://petesbloggerama.blogspot.com
    > Short urls & more: http://ittyurl.net
    >
    >
    >
    > "Bob" wrote:
    >
    > > Does anyone know how to clear the window so it's easier to see the
    > > stuff you have listed with Debug.Write(xyz)?

    >
    > > Bob Sweeney- Hide quoted text -

    >
    > - Show quoted text -


    I mean programmatically so I can see my Debug.Write results
     
    Bob, Mar 22, 2007
    #3
  4. Bob

    Guest Guest

    Programmatically, you need to work with the DTE80 assembly which comes in
    either COM or .NET flavors. I don't know exactly how to do it, but there are
    plenty of code samples on MSDN to get you started.
    Peter
    --
    Site: http://www.eggheadcafe.com
    UnBlog: http://petesbloggerama.blogspot.com
    Short urls & more: http://ittyurl.net




    "Bob" wrote:

    > On Mar 22, 12:21 pm, Peter Bromberg [C# MVP]
    > <> wrote:
    > > Try right-clicking inside the Output window and look at the context menu
    > > options.
    > > Peter
    > > --
    > > Site: http://www.eggheadcafe.com
    > > UnBlog: http://petesbloggerama.blogspot.com
    > > Short urls & more: http://ittyurl.net
    > >
    > >
    > >
    > > "Bob" wrote:
    > >
    > > > Does anyone know how to clear the window so it's easier to see the
    > > > stuff you have listed with Debug.Write(xyz)?

    > >
    > > > Bob Sweeney- Hide quoted text -

    > >
    > > - Show quoted text -

    >
    > I mean programmatically so I can see my Debug.Write results
    >
    >
    >
     
    Guest, Mar 22, 2007
    #4
  5. Bob

    Zytan Guest

    > Does anyone know how to clear the window so it's easier to see the
    > stuff you have listed with Debug.Write(xyz)?


    You can't programmatically. I know, it sucks. Best to make a logger
    and use that instead. Although, sometimes the Output window info is
    useful, so its not a complete waste. But, for general debugging it
    pretty much is.

    I wonder if you can just create a console, like in Win32 apps? And
    use that? That'd be the easiest solution, I imagine. But, last I
    heard you couldn't instantiate Console in .NET 2.0 or later.

    Zytan
     
    Zytan, Mar 23, 2007
    #5
  6. Bob

    Guest Guest

    Zytan,
    This is inaccurate. With the EnvDTE80 namespace you have programmatic access
    to all of the IDE, its windows, and their contents:

    http://msdn2.microsoft.com/en-us/library/0e105c68(VS.80).aspx
    http://msdn2.microsoft.com/en-us/library/envdte(VS.80).aspx



    -- Peter
    Site: http://www.eggheadcafe.com
    UnBlog: http://petesbloggerama.blogspot.com
    Short urls & more: http://ittyurl.net




    "Zytan" wrote:

    > > Does anyone know how to clear the window so it's easier to see the
    > > stuff you have listed with Debug.Write(xyz)?

    >
    > You can't programmatically. I know, it sucks. Best to make a logger
    > and use that instead. Although, sometimes the Output window info is
    > useful, so its not a complete waste. But, for general debugging it
    > pretty much is.
    >
    > I wonder if you can just create a console, like in Win32 apps? And
    > use that? That'd be the easiest solution, I imagine. But, last I
    > heard you couldn't instantiate Console in .NET 2.0 or later.
    >
    > Zytan
    >
    >
     
    Guest, Mar 23, 2007
    #6
  7. Bob

    Laura T. Guest

    Yup. This works. But is it worth of it?

    private void ClearOutput()
    {
    EnvDTE80.DTE2 ide =
    (EnvDTE80.DTE2)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.8.0");
    ide.ExecuteCommand("Edit.ClearOutputWindow","");
    System.Runtime.InteropServices.Marshal.ReleaseComObject(ide);
    }

    "Peter Bromberg [C# MVP]" <> ha scritto nel
    messaggio news:...
    > Zytan,
    > This is inaccurate. With the EnvDTE80 namespace you have programmatic
    > access
    > to all of the IDE, its windows, and their contents:
    >
    > http://msdn2.microsoft.com/en-us/library/0e105c68(VS.80).aspx
    > http://msdn2.microsoft.com/en-us/library/envdte(VS.80).aspx
    >
    >
    >
    > -- Peter
    > Site: http://www.eggheadcafe.com
    > UnBlog: http://petesbloggerama.blogspot.com
    > Short urls & more: http://ittyurl.net
    >
    >
    >
    >
    > "Zytan" wrote:
    >
    >> > Does anyone know how to clear the window so it's easier to see the
    >> > stuff you have listed with Debug.Write(xyz)?

    >>
    >> You can't programmatically. I know, it sucks. Best to make a logger
    >> and use that instead. Although, sometimes the Output window info is
    >> useful, so its not a complete waste. But, for general debugging it
    >> pretty much is.
    >>
    >> I wonder if you can just create a console, like in Win32 apps? And
    >> use that? That'd be the easiest solution, I imagine. But, last I
    >> heard you couldn't instantiate Console in .NET 2.0 or later.
    >>
    >> Zytan
    >>
    >>
     
    Laura T., Mar 23, 2007
    #7
  8. Bob

    Zytan Guest

    > This is inaccurate. With the EnvDTE80 namespace you have programmatic access
    > to all of the IDE, its windows, and their contents:
    >
    > http://msdn2.microsoft.com/en-us/library/0e105c68(VS.80).aspxhttp://msdn2.microsoft.com/en-us/library/envdte(VS.80).aspx


    I thought you could, but not from C#, which is what I meant. But, I
    see that you can from C#, as Laura has shown with the content you
    provided.

    Zytan
     
    Zytan, Mar 23, 2007
    #8
  9. Bob

    Zytan Guest

    > Yup. This works. But is it worth of it?
    >
    > private void ClearOutput()
    > {
    > EnvDTE80.DTE2 ide =
    > (EnvDTE80.DTE2)System.Runtime.InteropServices.Marshal.GetActiveObject("Visu­alStudio.DTE.8.0");
    > ide.ExecuteCommand("Edit.ClearOutputWindow","");
    > System.Runtime.InteropServices.Marshal.ReleaseComObject(ide);
    > }


    Thanks for the example, Laura.

    What do you imply by your question? I have one question, and maybe
    this is what you are getting at: Is there any reason why the Output
    Windows is NOT cleared? I'd prefer it cleared every time. Oh, wait,
    I think I know why: because you'll clear the start-up logging of the
    process. We actually want it to be cleared BEFORE that, so that only
    the current run is shown in the window. Yeah, so this is why it is
    likely not worth it. And thus, a logger is a better idea.

    Zytan
     
    Zytan, Mar 23, 2007
    #9
  10. Bob

    Zytan Guest

    > We actually want it to be cleared BEFORE that, so that only
    > the current run is shown in the window.


    Actually, only the current execution is shown in the Output Window.
    So all is ok.

    I was certain that before this wasn't the case. I think I was
    thinking about how it works in VB, which is quite different.

    Zytan
     
    Zytan, Mar 23, 2007
    #10
  11. This crashed in VS2008

    I couldn't get this code to work in VS2008, but when I changed the string "VisualStudio.DTE.8.0" to "VisualStudio.DTE.9.0" it worked like a champ!

    Thanks!

    > On Thursday, March 22, 2007 5:46 AM Bob wrote:


    > Does anyone know how to clear the window so it is easier to see the
    > stuff you have listed with Debug.Write(xyz)?
    >
    > Bob Sweeney



    >> On Thursday, March 22, 2007 6:21 AM pbromber wrote:


    >> Try right-clicking inside the Output window and look at the context menu
    >> options.
    >> Peter
    >> --
    >> Site: http://www.eggheadcafe.com
    >> UnBlog: http://petesbloggerama.blogspot.com
    >> Short urls & more: http://ittyurl.net
    >>
    >>
    >>
    >>
    >> "Bob" wrote:



    >>> On Thursday, March 22, 2007 6:49 AM Bob wrote:


    >>> I mean programmatically so I can see my Debug.Write results



    >>>> On Thursday, March 22, 2007 6:00 PM pbromber wrote:


    >>>> Programmatically, you need to work with the DTE80 assembly which comes in
    >>>> either COM or .NET flavors. I don't know exactly how to do it, but there are
    >>>> plenty of code samples on MSDN to get you started.
    >>>> Peter
    >>>> --
    >>>> Site: http://www.eggheadcafe.com
    >>>> UnBlog: http://petesbloggerama.blogspot.com
    >>>> Short urls & more: http://ittyurl.net
    >>>>
    >>>>
    >>>>
    >>>>
    >>>> "Bob" wrote:



    >>>>> On Thursday, March 22, 2007 7:41 PM Zytan wrote:


    >>>>> You can't programmatically. I know, it sucks. Best to make a logger
    >>>>> and use that instead. Although, sometimes the Output window info is
    >>>>> useful, so its not a complete waste. But, for general debugging it
    >>>>> pretty much is.
    >>>>>
    >>>>> I wonder if you can just create a console, like in Win32 apps? And
    >>>>> use that? That'd be the easiest solution, I imagine. But, last I
    >>>>> heard you couldn't instantiate Console in .NET 2.0 or later.
    >>>>>
    >>>>> Zytan



    >>>>>> On Friday, March 23, 2007 4:53 AM pbromber wrote:


    >>>>>> Zytan,
    >>>>>> This is inaccurate. With the EnvDTE80 namespace you have programmatic access
    >>>>>> to all of the IDE, its windows, and their contents:
    >>>>>>
    >>>>>> http://msdn2.microsoft.com/en-us/library/0e105c68(VS.80).aspx
    >>>>>> http://msdn2.microsoft.com/en-us/library/envdte(VS.80).aspx
    >>>>>>
    >>>>>>
    >>>>>>
    >>>>>> -- Peter
    >>>>>> Site: http://www.eggheadcafe.com
    >>>>>> UnBlog: http://petesbloggerama.blogspot.com
    >>>>>> Short urls & more: http://ittyurl.net
    >>>>>>
    >>>>>>
    >>>>>>
    >>>>>>
    >>>>>> "Zytan" wrote:



    >>>>>>> On Friday, March 23, 2007 9:32 AM Laura T. wrote:


    >>>>>>> Yup. This works. But is it worth of it?
    >>>>>>>
    >>>>>>> private void ClearOutput()
    >>>>>>> {
    >>>>>>> EnvDTE80.DTE2 ide =
    >>>>>>> (EnvDTE80.DTE2)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.8.0");
    >>>>>>> ide.ExecuteCommand("Edit.ClearOutputWindow","");
    >>>>>>> System.Runtime.InteropServices.Marshal.ReleaseComObject(ide);
    >>>>>>> }
    >>>>>>>
    >>>>>>> "Peter Bromberg [C# MVP]" <> ha scritto nel
    >>>>>>> messaggio news:...



    >>>>>>>> On Friday, March 23, 2007 11:50 AM Zytan wrote:


    >>>>>>>> I thought you could, but not from C#, which is what I meant. But, I
    >>>>>>>> see that you can from C#, as Laura has shown with the content you
    >>>>>>>> provided.
    >>>>>>>>
    >>>>>>>> Zytan



    >>>>>>>>> On Friday, March 23, 2007 11:53 AM Zytan wrote:


    >>>>>>>>> su=ADalStudio.DTE.8.0");
    >>>>>>>>>
    >>>>>>>>> Thanks for the example, Laura.
    >>>>>>>>>
    >>>>>>>>> What do you imply by your question? I have one question, and maybe
    >>>>>>>>> this is what you are getting at: Is there any reason why the Output
    >>>>>>>>> Windows is NOT cleared? I'd prefer it cleared every time. Oh, wait,
    >>>>>>>>> I think I know why: because you'll clear the start-up logging of the
    >>>>>>>>> process. We actually want it to be cleared BEFORE that, so that only
    >>>>>>>>> the current run is shown in the window. Yeah, so this is why it is
    >>>>>>>>> likely not worth it. And thus, a logger is a better idea.
    >>>>>>>>>
    >>>>>>>>> Zytan



    >>>>>>>>>> On Friday, March 23, 2007 1:20 PM Zytan wrote:


    >>>>>>>>>> Actually, only the current execution is shown in the Output Window.
    >>>>>>>>>> So all is ok.
    >>>>>>>>>>
    >>>>>>>>>> I was certain that before this wasn't the case. I think I was
    >>>>>>>>>> thinking about how it works in VB, which is quite different.
    >>>>>>>>>>
    >>>>>>>>>> Zytan



    >>>>>>>>>> Submitted via EggHeadCafe - Software Developer Portal of Choice
    >>>>>>>>>> Simple .NET HEX PixelColor Utility
    >>>>>>>>>> http://www.eggheadcafe.com/tutorial...f52bc1/simple-net-hex-pixelcolor-utility.aspx
     
    Pete Nolastname, Sep 28, 2010
    #11
  12. Pete Nolastname, Sep 28, 2010
    #12
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. chris
    Replies:
    5
    Views:
    429
    Daniel O'Connell [C# MVP]
    Jan 31, 2004
  2. John Smith

    [Conditional("DEBUG")] or #if DEBUG

    John Smith, Feb 6, 2004, in forum: Microsoft C# .NET
    Replies:
    10
    Views:
    458
    Jon Skeet [C# MVP]
    Feb 9, 2004
  3. Ollie Riches

    debug\output style window inside a winform application.

    Ollie Riches, Aug 5, 2005, in forum: Microsoft C# .NET
    Replies:
    1
    Views:
    224
    Herfried K. Wagner [MVP]
    Aug 6, 2005
  4. Bob

    Output-Debug Window Clearing

    Bob, Mar 22, 2007, in forum: Microsoft C# .NET
    Replies:
    2
    Views:
    238
    RobinS
    Mar 23, 2007
  5. Rich P
    Replies:
    1
    Views:
    784
    Pete Nolastname
    Oct 1, 2010
Loading...

Share This Page