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

To retrieve input typed in a text box

  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 TextBox control onto the form, and change the following properties in the Properties window:

    Property

    Value

    Name

    inputText

    Multiline

    True

    Size

    175, 90

  2. Add a Button control next to the text box, and change the following properties:

    Property

    Value

    Name

    retrieveInput

    Text

    Retrieve

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

    MessageBox.Show(this.inputText.Text);

  4. Press F5 to run the program.

  5. Type multiple lines of text in the text box, and then click Retrieve.

  6. Verify that the message displays all the text that you typed in the text box.