< Day Day Up > |
The With statement simplifies repeatedly accessing the members of a value. Within a With statement, an expression beginning with just a period or an exclamation point is interpreted as if the With expression preceded it. For example: With TextBox1 .TabIndex = 0 .ForeColor = Color.Red .Text = "Red" .Show() End With The With expression is evaluated only once, at the beginning of the statement, so any changes to the underlying value of the With expression won't be applied until the With statement is reexecuted. With TextBox1 TextBox1 = New TextBox() .TabIndex = 0 .ForeColor = Color.Red .Text = "Red" .Show() End With In this example, the original text box will be modified, even though the value in the TextBox1 variable has been changed. |
< Day Day Up > |