From the main menu click on New Project and then give a name to your project, for example the default, WpfApp1, and then click
Ok or press Enter.
The following screen opens up to start the newly created application.
A Visual C# application project starts with creating its GUI with Designer, Toolbox, and Property window. In the Designer, an empty form is automatically created where:
The rules for naming controls are illustrated here
GUI applications are event-driven which means they interact with users. An event is a user's action including mouse clicking and key pressing.
Double clicking a control, such as Button, will link the control to a default Event Handler
C# code, a file that contains program code is called a source code file, is organized in three ways:
Each time a new project is created the following two source code files are automatically created
Organization of Form1.cs:
Basically, C# code is organized as methods, which are contained inside classes, which are contained inside namespaces
By adding the following bold line to a Button's event handler, a Label control can display output of the application.
private void showAnswerButton_Click(object sender, EventArgs e)
{
answerLabel.Text = "Abraham Lincoln";
}
The Text property accepts string only and to clear the text of a Label, the following code can be used: answerLabel.Text = ""