Monday, January 4, 2010

label control in VB 6.0

Label tutorial in Visual Basic

Label is one of the most used control in Visual Basic Designer. By the name implies label is used to display a descriptive text / message about the preceding control. For example there may be a text box control to receive customer Name. We put a label before the text box to intimate the user that he should type the customer name in the box.

The most common properties of label control is Caption property and name property. Label also supports database connectivity. You can connect a label control to a database table, and link a field from the table to display its contents. Another popular property is Visible. You can either set True or False to show or hide the control.

For example, you can add a Label to the top of a Form that provides instructions to the user on how to input data in the controls on the form. Label controls can be also used to display run time information on the status of an application. For example, you can add a Label control to a form to display the status of each file as a list of files is processed.

You can create a simple clock project to display and update current time. Just put a timer control on the form and set the timer interval to 1000 milliseconds. In the timer event set the lable's caption property to Time(). This will update the time each second. We will learn more about timer control in subsequent lessons.