VB 6 Form Title

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.

Advertisements
  • 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.

Use Property window to change the Caption
Use Property window to change the Caption

In the above figure, we have used caption attribute to set the title for the form object. In the same way you can change Height and Width of the form, set a background color for the form and so on.

Advertisements
Form title changed to Salary
Form title changed to Salary

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 – code editor.

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 "Finance".
  • Change the background color to "Orange".
Changing Form Title During Run-time
Changing Form Title During Run-time

Advertisements

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.