Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Clearing the Console

Clearing the Console

Scheduled Pinned Locked Moved Visual Basic
csharpquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mightymiracleman
    wrote on last edited by
    #1

    I can't believe I haven't been able to find any way to clear the console screen in vb.net. All I want is to clear the console screen just like issuing a cls command at a command prompt. Does anyone out there know how this is done?

    M Richard DeemingR 2 Replies Last reply
    0
    • M mightymiracleman

      I can't believe I haven't been able to find any way to clear the console screen in vb.net. All I want is to clear the console screen just like issuing a cls command at a command prompt. Does anyone out there know how this is done?

      M Offline
      M Offline
      Mike Dimmick
      wrote on last edited by
      #2

      You could try P/Invoke'ing the FillConsoleOutputCharacter function. See MSDN Library for details.

      M 1 Reply Last reply
      0
      • M Mike Dimmick

        You could try P/Invoke'ing the FillConsoleOutputCharacter function. See MSDN Library for details.

        M Offline
        M Offline
        mightymiracleman
        wrote on last edited by
        #3

        Thank you! I found it in the MSDN libraries url is http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B319239 if anyone is interested. A WHOLE lot of work just to clear the console, I can't believe they didn't include this functionality in the Console namespace. Oh well, maybe next time. Thanks again!

        M 1 Reply Last reply
        0
        • M mightymiracleman

          Thank you! I found it in the MSDN libraries url is http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B319239 if anyone is interested. A WHOLE lot of work just to clear the console, I can't believe they didn't include this functionality in the Console namespace. Oh well, maybe next time. Thanks again!

          M Offline
          M Offline
          Mike Dimmick
          wrote on last edited by
          #4

          If it's any consolation (no pun intended), there's no function for this that I can see in the C runtime library either - I was going to look at the implementation if there was one. In case anyone else wants that article, clickety[^].

          1 Reply Last reply
          0
          • M mightymiracleman

            I can't believe I haven't been able to find any way to clear the console screen in vb.net. All I want is to clear the console screen just like issuing a cls command at a command prompt. Does anyone out there know how this is done?

            Richard DeemingR Online
            Richard DeemingR Online
            Richard Deeming
            wrote on last edited by
            #5

            Have a look at Tim Sneath's sample on GotDotNet for some of the missing console functions: http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=b76d1f08-2d79-47bd-825b-0489938aae0f[^]


            "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

            "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups