Skip to content

Latest commit

 

History

History
34 lines (31 loc) · 2.36 KB

File metadata and controls

34 lines (31 loc) · 2.36 KB
title Other Control Structures (Visual Basic)
ms.custom
ms.date 07/20/2015
ms.prod .net
ms.reviewer
ms.suite
ms.technology
devlang-visual-basic
ms.topic article
helpviewer_keywords
statements [Visual Basic], control flow
control structures [Visual Basic]
ms.assetid 24b811f7-98ba-40ec-8dd3-4d528cfa4574
caps.latest.revision 19
author dotnet-bot
ms.author dotnetcontent

Other Control Structures (Visual Basic)

[!INCLUDEvbprvb] provides control structures that help you dispose of a resource or reduce the number of times you have to repeat an object reference.

Using...End Using Construction

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.

With...End With Construction

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.

See Also

Control Flow
Decision Structures
Loop Structures
Nested Control Structures
Using Statement
With...End With Statement