View contents of this chapter

The Text Box Control

Use the text box control when you want the user to type something, such as an answer to a question. Often a default value is helpful for your users, and VB can supply an initial value. For instance, if you are asking the user to enter a date, you might place today's date in the text box so that the user can accept the date without having to enter it.

Play Sound A TextBox control is sometimes called an edit field or edit control.

Some useful text box properties are listed below:

  • Locked: It determines whether a user can enter a value or change the default value of the text box.
  • MaxLength: This property specifies the maximum number of characters that can be entered in the TextBox.
  • MultiLine: If True, the property specifes that the text box can hold more than a single line of text. This property is read only at runtime.
  • PasswordChar: This property designates a character, such as an asterisk, that will appear in place of the characters the user types into the text box.
  • ScrollBars: This property determines whether an object has horizontal or vertical scroll bars.
  • Text: This property specifies the initial text (the default value) that appears in the text box.

Play Sound For vertical scrollbars to appear in a text box, you must set the MultiLine property to True.

Play Sound Load and run the sample application called controls from your MSDN's Samples folder. Select the text box option to practice using text boxes.


© Universal Teacher Publications        INDEX Previous Screen Next Screen