logo search
Учебник_ПОА

To display text in a label

  1. On the File menu, click NewProject.

  2. In the New Project dialog box, click Windows Forms Application, and then click OK.

A new Windows Forms project opens.

  1. From the Toolbox, drag a Label onto the form.

  2. Add a Button control to the form, and change the following properties:

    Property

    Value

    Name

    changeText

    Text

    Change Text

    Size

    80, 23

  3. Double-click the button to create the changeText_Click event handler, and add the following code:

this.label1.Text = "Time " + DateTime.Now.ToLongTimeString();