VB 6 With Statement

The With statement is not a loop, but can be as useful as a loop. In this article, we will discuss about the With statement.

Advertisements

The syntax for the width statement is given below.

With object
[Statements]
End With

Example: With Statement

In the following example, we will use With statement to set some properties of a Textbox control.

Advertisements
Private Sub Command1_Click()
With Text1
  .Width = 2500
  .Height = 800
  .Text = "NotesforMsc"
End With
End Sub

In the above example, we can see that the properties of a textbox is changed using With statement when a user clicks the Command1 button.

Not only textbox control, we can change many other properties of Visual Basic 6 control objects.

Output: With Statement

The output of the above program is given below.

Figure 1 – Output – With Statement
Advertisements

Ads Blocker Detected!!!

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

Exit mobile version