Output Window

  • Thread starter Thread starter Greg
  • Start date Start date
G

Greg

I am using the following command to output my results to the Output window
(for testing things out).

Console.WriteLine ("Output")

I'd like to clear the Output window of any previous output. I tried

Console.Clear

but, this results in an error.

Is there a way to clear previous output text in the Output Window?
 
Greg,
In this hello world console application, clear function clears "hello world"
line properly. Then you must look at your code again:

Module Module1

Sub Main()
Console.WriteLine("hello world")
Console.Clear()
' Pause
Console.ReadLine()

End Sub

End Module

HTH,

Onur
 
I have used the Console.Clear method, but it gives me a "The Handle is
Invalid" error message. It doesn't appear in my ERROR window, so I'm not
understanding why this won't work. Any suggestions? I am using like in the
following lines of code.

Public Sub DirFiles()
Dim ourDir As System.IO.DirectoryInfo = New
System.IO.DirectoryInfo("C:\VBTEST")
Console.Clear()
Console.WriteLine("Directory: {0}", ourDir.FullName)
Dim myFile As System.IO.FileInfo
For Each myFile In ourDir.GetFiles
Console.WriteLine("File: {0}", myFile.FullName)
Next myFile
Console.WriteLine("Root: {0}", ourDir.Root)
End Sub

Do you see anything wrong that would cause the Console.Clear method not to
work?

Thanks, Greg
 
I suspect your application is compiled as a windows application rather than a
console application. Do you need to run as a windows application?
 
OK, that is probably it. I'm studying for Microsoft Exam and it instructs me
to create a console applicaiton for each Exercise, but I'm justing doing all
of it in one Windows Applicaiton instead to build on common project with all
my examples to review.

I suspect I should probably be using the Debug statement instead, right?

Thanks.
 
Well, debug would make more sense in your case. It doesn't have a Clear
method though.
 
Hi Greg,

The Console.Clear method only applies to a Console application.

To clear the content of the Output window programmatically, we need to
write an add-in or macro to automate VS IDE.

For more information on how to manage macros, you may refer to the
following MSDN document:
'How to: Manage Macros'
http://msdn2.microsoft.com/en-us/library/hdf2d1z8.aspx

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top