Sideway
output.to from Sideway
Draft for Information Only

Content

VB.NET Flow Statements
  End Statement
  Syntax
  Remarks
  Smart Device Developer Notes
  See also
 End <keyword> Statement
  Syntax
  Parts
  Directives
  Remarks
  Smart Device Developer Notes
  See also
 Stop Statement
  Syntax
  Remarks
  See also
 Source/Reference

VB.NET Flow Statements

The supporting VB.NET Flow Control Statements are End, End <keyword>           Throw

End Statement

Terminates execution immediately.

Syntax

End  

Remarks

You can place the End statement anywhere in a procedure to force the entire application to stop running. End closes any files opened with an Open statement and clears all the application's variables. The application closes as soon as there are no other programs holding references to its objects and none of its code is running.

Note

The End statement stops code execution abruptly, and does not invoke the Dispose or Finalize method, or any other Visual Basic code. Object references held by other programs are invalidated. If an End statement is encountered within a Try or Catch block, control does not pass to the corresponding Finally block.

The Stop statement suspends execution, but unlike End, it does not close any files or clear any variables, unless it is encountered in a compiled executable (.exe) file.

Because End terminates your application without attending to any resources that might be open, you should try to close down cleanly before using it. For example, if your application has any forms open, you should close them before control reaches the End statement.

You should use End sparingly, and only when you need to stop immediately. The normal ways to terminate a procedure (Return Statement and Exit Statement) not only close down the procedure cleanly but also give the calling code the opportunity to close down cleanly. A console application, for example, can simply Return from the Main procedure.

Important

The End statement calls the Exit method of the Environment class in the System namespace. Exit requires that you have UnmanagedCode permission. If you do not, a SecurityException error occurs.

When followed by an additional keyword, End <keyword> Statement delineates the end of the definition of the appropriate procedure or block. For example, End Function terminates the definition of a Function procedure.

Smart Device Developer Notes

This statement is not supported.

See also

End <keyword> Statement

When followed by an additional keyword, terminates the definition of the statement block introduced by that keyword.

Syntax

VB
End AddHandler
End Class
End Enum
End Event
End Function
End Get
End If
End Interface
End Module
End Namespace
End Operator
End Property
End RaiseEvent  
End RemoveHandler  
End Select
End Set
End Structure
End Sub
End SyncLock
End Try
End While
End With  

Parts

Part Description
End Required. Terminates the definition of the programming element.
AddHandler Required to terminate an AddHandler accessor begun by a matching AddHandler statement in a custom Event Statement.
Class Required to terminate a class definition begun by a matching Class Statement.
Enum Required to terminate an enumeration definition begun by a matching Enum Statement.
Event Required to terminate a Custom event definition begun by a matching Event Statement.
Function Required to terminate a Function procedure definition begun by a matching Function Statement. If execution encounters an End Function statement, control returns to the calling code.
Get Required to terminate a Property procedure definition begun by a matching Get Statement. If execution encounters an End Get statement, control returns to the statement requesting the property's value.
If Required to terminate an If...Then...Else block definition begun by a matching If statement. See If...Then...Else Statement.
Interface Required to terminate an interface definition begun by a matching Interface Statement.
Module Required to terminate a module definition begun by a matching Module Statement.
Namespace Required to terminate a namespace definition begun by a matching Namespace Statement.
Operator Required to terminate an operator definition begun by a matching Operator Statement.
Property Required to terminate a property definition begun by a matching Property Statement.
RaiseEvent Required to terminate a RaiseEvent accessor begun by a matching RaiseEvent statement in a custom Event Statement.
RemoveHandler Required to terminate a RemoveHandler accessor begun by a matching RemoveHandler statement in a custom Event Statement.
Select Required to terminate a Select...Case block definition begun by a matching Select statement. See Select...Case Statement.
Set Required to terminate a Property procedure definition begun by a matching Set Statement. If execution encounters an End Set statement, control returns to the statement setting the property's value.
Structure Required to terminate a structure definition begun by a matching Structure Statement.
Sub Required to terminate a Sub procedure definition begun by a matching Sub Statement. If execution encounters an End Sub statement, control returns to the calling code.
SyncLock Required to terminate a SyncLock block definition begun by a matching SyncLock statement. See SyncLock Statement.
Try Required to terminate a Try...Catch...Finally block definition begun by a matching Try statement. See Try...Catch...Finally Statement.
While Required to terminate a While loop definition begun by a matching While statement. See While...End While Statement.
With Required to terminate a With block definition begun by a matching With statement. See With...End With Statement.

Directives

When preceded by a number sign (#), the End keyword terminates a preprocessing block introduced by the corresponding directive.

VB
#End ExternalSource
#End If
#End Region
Part Description
#End Required. Terminates the definition of the preprocessing block.
ExternalSource Required to terminate an external source block begun by a matching #ExternalSource Directive.
If Required to terminate a conditional compilation block begun by a matching #If directive. See #If...Then...#Else Directives.
Region Required to terminate a source region block begun by a matching #Region Directive.

Remarks

The End Statement, without an additional keyword, terminates execution immediately.

Smart Device Developer Notes

The End statement, without an additional keyword, is not supported.

See also

Stop Statement

Suspends execution.

Syntax

Stop  

Remarks

You can place Stop statements anywhere in procedures to suspend execution. Using the Stop statement is similar to setting a breakpoint in the code.

The Stop statement suspends execution, but unlike End, it does not close any files or clear any variables, unless it is encountered in a compiled executable (.exe) file.

Note

If the Stop statement is encountered in code that is running outside of the integrated development environment (IDE), the debugger is invoked. This is true regardless of whether the code was compiled in debug or retail mode.

See also

 

Source/Reference


©sideway

ID: 200800012 Last Updated: 8/12/2020 Revision: 0 Ref:

close

References

  1. Active Server Pages,  , http://msdn.microsoft.com/en-us/library/aa286483.aspx
  2. ASP Overview,  , http://msdn.microsoft.com/en-us/library/ms524929%28v=vs.90%29.aspx
  3. ASP Best Practices,  , http://technet.microsoft.com/en-us/library/cc939157.aspx
  4. ASP Built-in Objects,  , http://msdn.microsoft.com/en-us/library/ie/ms524716(v=vs.90).aspx
  5. Response Object,  , http://msdn.microsoft.com/en-us/library/ms525405(v=vs.90).aspx
  6. Request Object,  , http://msdn.microsoft.com/en-us/library/ms524948(v=vs.90).aspx
  7. Server Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms525541(v=vs.90).aspx
  8. Application Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms525360(v=vs.90).aspx
  9. Session Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms524319(8v=vs.90).aspx
  10. ASPError Object,  , http://msdn.microsoft.com/en-us/library/ms524942(v=vs.90).aspx
  11. ObjectContext Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms525667(v=vs.90).aspx
  12. Debugging Global.asa Files,  , http://msdn.microsoft.com/en-us/library/aa291249(v=vs.71).aspx
  13. How to: Debug Global.asa files,  , http://msdn.microsoft.com/en-us/library/ms241868(v=vs.80).aspx
  14. Calling COM Components from ASP Pages,  , http://msdn.microsoft.com/en-us/library/ms524620(v=VS.90).aspx
  15. IIS ASP Scripting Reference,  , http://msdn.microsoft.com/en-us/library/ms524664(v=vs.90).aspx
  16. ASP Keywords,  , http://msdn.microsoft.com/en-us/library/ms524672(v=vs.90).aspx
  17. Creating Simple ASP Pages,  , http://msdn.microsoft.com/en-us/library/ms524741(v=vs.90).aspx
  18. Including Files in ASP Applications,  , http://msdn.microsoft.com/en-us/library/ms524876(v=vs.90).aspx
  19. ASP Overview,  , http://msdn.microsoft.com/en-us/library/ms524929(v=vs.90).aspx
  20. FileSystemObject Object,  , http://msdn.microsoft.com/en-us/library/z9ty6h50(v=vs.84).aspx
  21. http://msdn.microsoft.com/en-us/library/windows/desktop/ms675944(v=vs.85).aspx,  , ADO Object Model
  22. ADO Fundamentals,  , http://msdn.microsoft.com/en-us/library/windows/desktop/ms680928(v=vs.85).aspx
close

Latest Updated LinksValid XHTML 1.0 Transitional Valid CSS!Nu Html Checker Firefox53 Chromena IExplorerna
IMAGE

Home 5

Business

Management

HBR 3

Information

Recreation

Hobbies 8

Culture

Chinese 1097

English 339

Reference 79

Computer

Hardware 249

Software

Application 213

Digitization 32

Latex 52

Manim 205

KB 1

Numeric 19

Programming

Web 289

Unicode 504

HTML 66

CSS 65

SVG 46

ASP.NET 270

OS 429

DeskTop 7

Python 72

Knowledge

Mathematics

Formulas 8

Algebra 84

Number Theory 206

Trigonometry 31

Geometry 34

Coordinate Geometry 2

Calculus 67

Complex Analysis 21

Engineering

Tables 8

Mechanical

Mechanics 1

Rigid Bodies

Statics 92

Dynamics 37

Fluid 5

Fluid Kinematics 5

Control

Process Control 1

Acoustics 19

FiniteElement 2

Natural Sciences

Matter 1

Electric 27

Biology 1

Geography 1


Copyright © 2000-2024 Sideway . All rights reserved Disclaimers last modified on 06 September 2019