c# winform close windows program code example Example 1: how to exit a program in c# Application.Exit(); Example 2: how to close a form c# this.Close();