A VB 6 form has a title bar and the title of the form can be changed. In this article, we will talk about two ways to change the title of a form object.
- Change title from property window.
- Change title during run-time from code editor.
Change title using property window
When you select a VB 6 from in the IDE. You will notice that on left hand corner window , there is a small section called
Property Window, which shows all the properties of the form object.
We can change the title and some other property of a form easily. This is most preferred way to things in VB 6.
In the above figure, we have used
caption attribute to set the title for the form object. In the same way you can change
Width of the form, set a background color for the form and so on.
Changing title during run-time
You saw how we can change the title and other properties using property window for the form. Now, we will see another method of changing the title for the form –
You can write some code that will change the title and other attributes of a form.For example, consider the following code to change the title to “Finance”.
Private Sub Form_Load() Me.Caption = "Finance" Me.BackColor = RGB(255, 120, 0) End Sub
The above code will two things:
- Change the title to
- Change the background color to