Hello World in C#, A Starting WinForms Example
This article is a short tutorial on creating the most basic application for Windows in C#. A Windows Forms (WinForms) Hello World application. This C# WinForms beginners tutorial assumes that Microsoft Visual Studio is installed and ready to start a new project. Note: Based on experience Microsoft Visual Studio works best on a PC with an i3 or better processor, Solid State Disk (SSD) for the hard drive, 6GB+ of memory, and running Windows 10.
The Hello World program is usually the first program tried when new computers or software are tried out. Here a C# WinForms Hello World example is given. (The same steps are similar for a Visual Basic Hello World application.) With Visual Studio open use the File menu and select New then Project.
Select the Windows Forms Application for Visual C# and give it a name. WinForms provides a key building block for writing applications for Windows. WinForms based apps, using the Windows Application Programming Interface (API), have been around for many years, therefore WinForms is widely supported.
From the Visual Studo Toolbox drag and drop a Label onto the form.
Using the list of Properties change the Label text to Hello, World!.
Change other properties if required, e.g. the size of the font, alignment (TextAlign) and anchoring (Anchor). To change the title of the Windows form, click on the form and change the Text property (from Form1 to the required title).
This simple C# Hello World example app does not need any additional code. To run the application click the Start button on the toolbar. To learn more see the Microsoft Visual Studio guides.
On 30th December 2020 at 15:38pm Vikas said: Good example to create Hello World in a Windows app, if anyone needs a console application example, check Hello World C# program with explanation of code, Thanks.
Author:Daniel S. Fowler Published: