CST1620 C# / C++ Programming
Lab Week 1


Exercises

Exercise 1.1 (10 points)

Create a new project named Demo, and place 3 buttons on the form. Set their text to 1, 2, 3 respectively. Create three labels, and set their text to A, B, and C. Now place suitable code in the appropriate button methods so that:

(a) clicking button1 sets the text of all the labels to Yes.

(b) clicking button2 sets the text of all the labels to No.

(c) clicking button3 sets the text values of the labels back to A, B, C.

 

  Result (Save to your local machine and run)

Exercise 1.2 (10 points)

This involves the use of the Visible property of a control, which can be set to True or False. For example, the following code makes label1 invisible:

label1.Visible = False

Write a program with two buttons and one label. Clicking one button makes the label invisible, and clicking the other button makes it visible again.

 

  Result (Save to your local machine and run)