JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Using Labels Instead of Text Boxes

There are several advantages to using labels instead of text boxes in a Visual Basic program. Labels display read-only text (although you can make text boxes read-only by setting their ReadOnly property to True), and they give the appearance of text directly on the form; this can look much better than a text box on occasion. For example, you might want to display the result of a calculation in a label instead of a text box, so the user can't edit that result.

In fact, you can make text boxes and labels resemble each other. To make a text box look like a label, set the text box's BackColor property to Control in the popup box that appears when you set this property in the properties window; its ReadOnly property to True; and its BorderStyle property to None. To make a label look like a text box, set its BackColor property to Window and its BorderStyle property to Fixed3D.

Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor