For this exercise you are asked to write a Windows Forms application meeting the following specification. You may follow the worksheet for Practical 9 for step-by-step instructions on how to complete it.

  • The Form class must be named Form1. This is the default when creating a new Windows Forms app, but make sure that it doesn't change.
  • The form must be captioned Click Counter.
  • The form must contain a button with the text Click Me.
  • The form must contain a label with the initial text 0 times.
  • The form must contain a button with the text Reset. This button must start out disabled.
  • Whenever the Click Me button is clicked, the count in the label must increment (first to 1 times, then to 2 times and so on.)
  • The Reset button must be enabled when the Click Me button is clicked.
  • Whenever the Reset button is clicked, the count in the label must reset to 0 times.
  • Clicking the Reset button causes the Reset button to be disabled.

Screenshot of the program in its initial state: see image.

Writing the program

See Activity 1: Simple GUI Development in the Week 9 Practical Worksheet for a detailed walkthrough for how to complete this task and other GUI tasks.

For this activity you are not given sample code because Visual Studio creates a substantial framework for you already.

Here are some specific points to ensure when you are working on your program to ensure that AMS can work with it:

  • Make sure you create a Visual C# Windows Forms App (.NET Framework) when creating the project in Visual Studio.
  • The solution should be named PushCounter. This is not necessary; however the namespace must be named PushCounter and naming the solution PushCounter is a good way to ensure that it is correct by default.
  • The form must be named Form1. This is the default form name when creating a Windows Forms App.
  • Ensure that your buttons, captions etc. contain the text they are required to. The names of the buttons in the source code is irrelevant; however, the text on the buttons is used to find them within the form. The same is true for labels, checkboxes and any other form elements.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.