C# Console Apps vs Win Form Apps

C# Console Apps vs Win Form Apps

27/04/2020 0 By Admin

A console app is a program that runs in the console. The console is generally a black screen and the text is generally white, although you can program it to have other colors.

A console app does not have a graphical user interface (GUI).

When writing a console app you don’t need to worry about the GUI, as the end user interacts directly with the text on the screen.

In Visual Studio you can use C# to develop console apps or Win Forms apps that have a GUI. If you have used Windows you will be familiar with Win Forms apps.

The image below is from Visual Studio.  You can see that the project type selected is a Console App.  In the right panel you will see a standard description of this project type.

Let’s Code a Console App

This is a program for a simple console app to convert units of distance (Miles, Feet and Inches).

It will prompt the user for input and then print the result to the screen.

You can write a console app much quicker than a Win Forms app, because you don’t need to develop the GUI.

Let’s Code A Win Form App

The code above offers roughly the same functionality as the console app.  The difference is that it builds a windows app that accepts user input through a GUI and outputs the result to the GUI.

This is the GUI – Windows App

This windows app, however, has a few additional features such as:

  • blocking input from non-numeric keys;
  • reset function;
  • application exit function.

To complete this project, you could:

  • build a windows installer/uninstaller;
  • add a menu that might include version notes and a help file.