TextBoxes

Xojo Version 2021 r3.1

Description:

Textboxes can be used for either Input or Output on your form. When you use a TextBox for input you must cast it from a string to the appropriate data type before using it in your code.

When using a textbox for output, you must cast any variables to a string data type.

Library Location:

Textboxes (aka Text Fields) are found in the Inputs category in the Xojo Library

Naming Conventions:

The prefix for a TextBox is txt

Adding a TextBox to your form:

  • Place a TextBox onto your Form and give it a name (Remember to follow our naming conventions)
  • Place a Checkbox inside of the Group Box
  • In the Inspector, modify the following Properties:
    • Name (ie: txtHello)
    • Modify the appearance and size (user’s preference)
    • Modify the font (user’s preference)

Using a TextBox for Input

In the example below we are taking in information from a TextBox and assigning it to a variable.

firstName = txtName.text

Using a TextBox for Output

In the example below we are outputting some text and a variable to a TextBox.

txtOut.text = "Hello" + firstName + "!"