Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
This chapter is from the book


This workshop will help reinforce the concepts covered in today's lesson. It is very helpful to understand fully the answers before moving on. Answers can be found in Appendix A.


Questions 1–3 refer to the following code snippet:

1: using System;
2: using System.Windows.Forms;
3: using System.Drawing;
5: public class MyForm : Form {
6:   private Label lblMessage = new Label();
8:   public MyForm() {
9:    this.Text = "Hello World!";
10:   }
11: }
13: public class StartForm {
14:   public static void Main() {
15:    Application.Run(new MyForm());
16:   }
17: }  
  1. What would the following statement return if placed after line 9?

  2. Console.Write(this.ToString());
  3. What would the following code return if placed after line 9?

    Label lblTemp = new Label();
  4. What would the following code return if placed after line 9?

    Label lblTemp = new Label();
  5. Console.Write(Object.ReferenceEquals(lblTemp, this.lblMessage).ToString());
  6. True or false: The KeyPress event takes a handler of type KeyEventHandler.
  7. What are the five properties of the MouseEventArg object?
  8. Write a single statement in VB.NET that will set the width of a form to 1/3 of the height of the screen.

  9. What property controls which button will be activated when the user presses the Escape key?

  10. What is the default FormBorderStyle?

  11. Which three events use the two-event for a single action paradigm?


  1. Build an application, in C#, that monitors all six of the mouse events. Display a message in a label when each of the events occurs.

  2. Build an application in VB.NET that allows users to customize the Text, Height, Width, and Opacity properties by entering values in a TextBox, and pressing a Submit Button.

  • + Share This
  • 🔖 Save To Your Account