![]() ![]() | ||
The With statement is not a loop, properly speaking, but it can be as useful as a loop—and in fact, many programmers actually think of it as a loop. You use the With statement to execute statements using a particular object. Here's the syntax:
Here's an example showing how to put With to work. Here, I'm use a text box, Text1, in a Windows form program, and setting its Height, Width, and Text properties in the With statement:
With TextBox1 .Height = 1000 .Width = 3000 .Text = "Welcome to Visual Basic" End With
![]() ![]() | ||