Label in Visual Basic 6.0


Labels are one of the most commonly used controls in Visual Basic.  They are also the simplest to use.Label is used to display title,some text on the screen. This is placed aginest the other controls such as TextBox ,which is used to accept some input from the user.It provide the message what data to enter.Labels are drawn with a black font by default. However, you can set the label’s text color to match your application’s color scheme.
1. Create a new project

2. Add two Lable  from toolbox on the form.

 

 

 

 

 

 

 

 

3. Double click on Form to open code window and type the following code

Private Sub Form_Click()

Label1.Caption = “hello students”

Label2.Caption = “welcome”

End Sub

 

 

 

 

 

 

4.Use the File menu to save your work as Main.frm and (your intitials)Project1.vbp

5. Press F5 to run

 

 

 

 

 

 

 

5.  Click on the Form then

Comments are closed.