Clear Output/Debug window?

B

Bob

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
 
G

Guest

Try right-clicking inside the Output window and look at the context menu
options.
Peter
 
Z

Zytan

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
 
L

Laura T.

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);
}
 
Z

Zytan

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
 
Z

Zytan

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
 
P

Pete Nolastname

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!
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 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]" <[email protected]> ha scritto nel
messaggio news:[email protected]...
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top