// Programmer: Janet Joy // A global variable as a counter. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace counter { public partial class Form1 : Form { // Make counter global. int counter = 0; public Form1() { InitializeComponent(); } private void btnCount_Click(object sender, EventArgs e) { // Add 1 to counter and display as text of form. counter++; this.Text = "" + counter; } } }