Results 1 to 5 of 5

Thread: Console application help screen?

  1. #1
    techwiz24 is offline VB.NET Forum Enthusiast
    .NET Framework
    .NET 3.5
    Join Date
    Jun 2010
    Posts
    51
    Reputation
    40

    Question Console application help screen?

    I know with the windows default programs you can add the /? option after the program name and get a nicely formatted help screen. What i have right now is that when the program is called with the /? or -h option, the console simply writes some text. But the problem is that it is all mis-formatted and no longer lined up...any ideas?


    here's a snippit of my program. It's open source, if you want to check it out: http://www.sourceforge.com/projects/amake32
    Code:
    Dim operation_type As String = args(1)
    		Select Case operation_type
    Case "-h"
    				Console.WriteLine("--------------------------------------------------")
    				Console.WriteLine("amake32 version 0.5 created by techwiz24 (C) 2010")
    				Console.WriteLine("--------------------------------------------------")
    				Console.WriteLine("Mode " + args(1) + " [HELP]")
    				Console.WriteLine("Usage:  amake32 [Mode: -c -r -d -Ac -h (/?)] [Command (In quotes) If needed] [Name (no spaces)")
    				Console.WriteLine("Options:")
    				Console.WriteLine("				   -c        Mode Create, allows creation of windows aliases")
    				Console.WriteLine("                -r        Mode Read, reads the contents of the windows aliases")
    				Console.WriteLine("                -d        Mode Delete, deletes a windows alias, prompts for confirmation first")
    				Console.WriteLine("                -Ac       Mode assisted create, uses prompts to assist you with the creation of windows aliases")
    				Console.WriteLine("                -h or /?  Mode Help, shows this prompt")
    				Console.WriteLine("                [COMMAND] The exact text of the command prompt command. If you need new lines, use the GUI version of the program")
    				Console.WriteLine("                [NAME]    The name of the alias, this is the name you will use to call the alias from the command prompt")
    			Case "/?"
    				Console.WriteLine("--------------------------------------------------")
    				Console.WriteLine("amake32 version 0.5 created by techwiz24 (C) 2010")
    				Console.WriteLine("--------------------------------------------------")
    				Console.WriteLine("Mode " + args(1) + " [HELP]")
    				Console.WriteLine("Usage:  amake32 [Mode: -c -r -d -Ac -h (/?)] [Command (In quotes) If needed] [Name (no spaces)")
    				Console.WriteLine("Options:")
    				Console.WriteLine("				   -c        Mode Create, allows creation of windows aliases")
    				Console.WriteLine("                -r        Mode Read, reads the contents of the windows aliases")
    				Console.WriteLine("                -d        Mode Delete, deletes a windows alias, prompts for confirmation first")
    				Console.WriteLine("                -Ac       Mode assisted create, uses prompts to assist you with the creation of windows aliases")
    				Console.WriteLine("                -h or /?  Mode Help, shows this prompt")
    				Console.WriteLine("                [COMMAND] The exact text of the command prompt command. If you need new lines, use the GUI version of the program")
    				Console.WriteLine("                [NAME]    The name of the alias, this is the name you will use to call the alias from the command prompt")
    End Select
    Last edited by techwiz24; 10-07-2010 at 6:56 AM. Reason: added code snippit

  2. #2
    JohnH's Avatar
    JohnH is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Dec 2005
    Location
    Norway
    Posts
    14,197
    Reputation
    2368
    In first option line (-c) you have Tab chars instead of Space chars.
    The other problem is consoles usually have a width of 80 chars, which your lines exceeds and then wrap to next line. Console.BufferWidth is a get/set property.

  3. #3
    techwiz24 is offline VB.NET Forum Enthusiast
    .NET Framework
    .NET 3.5
    Join Date
    Jun 2010
    Posts
    51
    Reputation
    40
    Soo...how would I go about doing this? I'm not sure I understand the whole buffer thing...

    By the way, my IDE is SharpDevelop, had some licensing issues with VS2010 pro from dreamspark XD

  4. #4
    JohnH's Avatar
    JohnH is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Dec 2005
    Location
    Norway
    Posts
    14,197
    Reputation
    2368
    You can either set a width that is wide enough for you, or format your text according to standard console width of 80 chars. Learn more about Console class here Console Class (System)

    I use VB Express, I found that way better than SharpDevelop, at least that was the case some years ago.

  5. #5
    techwiz24 is offline VB.NET Forum Enthusiast
    .NET Framework
    .NET 3.5
    Join Date
    Jun 2010
    Posts
    51
    Reputation
    40
    yeah, i'm thinkin that also XD might switch over. I miss the better intilisense lol. SharpDev's really messy.

    Thank you for the reply!

Bookmarks

Posting Permissions

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