| title | Other Control Structures (Visual Basic) | ||
|---|---|---|---|
| ms.custom | |||
| ms.date | 07/20/2015 | ||
| ms.prod | .net | ||
| ms.reviewer | |||
| ms.suite | |||
| ms.technology |
|
||
| ms.topic | article | ||
| helpviewer_keywords |
|
||
| ms.assetid | 24b811f7-98ba-40ec-8dd3-4d528cfa4574 | ||
| caps.latest.revision | 19 | ||
| author | dotnet-bot | ||
| ms.author | dotnetcontent |
[!INCLUDEvbprvb] provides control structures that help you dispose of a resource or reduce the number of times you have to repeat an object reference.
The Using...End Using construction establishes a statement block within which you make use of a resource such as a SQL connection. You can optionally acquire the resource with the Using statement. When you exit the Using block, [!INCLUDEvbprvb] automatically disposes of the resource so that it is available for other code to use. The resource must be local and disposable. For more information, see Using Statement.
The With...End With construction lets you specify an object reference once and then run a series of statements that access its members. This can simplify your code and improve performance because [!INCLUDEvbprvb] does not have to re-establish the reference for each statement that accesses it. For more information, see With...End With Statement.
Control Flow
Decision Structures
Loop Structures
Nested Control Structures
Using Statement
With...End With Statement