Home>Tutorial>
List of Reserve Words in Visual Basic.Net
Nuelson Penuel
Friday, August 4, 2023
Visual Basic.Net
In VB.NET, keywords are reserved words that have a specific meaning and functionality within the language. These keywords cannot be used as variable names or identifiers. Here are some commonly used VB.NET keywords:
1. `AddHandler`: Used to create an event-handler to handle events raised by an object.
2. `Async`: Indicates that a method or lambda expression is asynchronous.
3. `ByRef`: Used to pass arguments to a procedure by reference, allowing the procedure to modify the original value.
4. `ByVal`: Used to pass arguments to a procedure by value, creating a copy of the original value in the parameter.
5. `Catch`: Used to catch and handle exceptions in a Try..Catch block.
6. `Class`: Used to define a class, which is a blueprint for creating objects.
7. `Continue`: Jumps to the next iteration of a loop without executing the remaining code within the loop.
8. `Dim`: Used to declare and allocate memory for a variable.
9. `Do`: Used to create a loop that executes a block of code repeatedly until a certain condition is met.
10. `Else`: Part of the if..then..else statement, it defines the code block to be executed if the condition is false.
11. `Exit`: Immediately exits a loop or a Sub/Function.
12. `Finally`: Used within a Try..Catch..Finally block to specify code that will always execute, regardless of whether an exception occurred or not.
13. `For`: Used to create a loop that iterates a specified number of times.
14. `Get`: Used to define the code that retrieves the value of a property.
15. `If`: Used to perform conditional execution of code, based on a specified condition.
16. `Imports`: Used to import namespaces, allowing the use of types and members from other assemblies.
17. `Inherits`: Specifies the base class of a derived class.
18. `New`: Used to create an instance of a class or a structure.
19. `Return`: Exits a Sub or Function and returns a value to the calling code.
20. `Try`: Used to enclose code that may generate exceptions and is followed by one or more Catch or Finally blocks.
21. `Module`: Used to define a module, which is a container for procedures, variables, constants, and events.
22. `MustInherit`: Specifies that a class is abstract and cannot be instantiated.
23. `MustOverride`: Indicates that a method in an abstract class or interface must be implemented in the derived class.
24. `Namespace`: Used to define a namespace, which is a way to organize code into logical groups.
25. `Not`: Used to perform logical negation, reversing the logical state of a Boolean expression.
26. `Operator`: Used to define custom operators for user-defined types.
27. `Option`: Used to specify certain compiler options for the entire project or a specific module.
28. `Overloads`: Indicates that a method or property with the same name exists multiple times with different parameters.
29. `Overrides`: Indicates that a method in a derived class overrides a method with the same name in the base class.
30. `Partial`: Specifies that a class, structure, interface, or module definition is spread across multiple files.
31. `Protected`: Restricts access to a class member to within the class itself and its derived classes.
32. `Public`: Declares a class member as accessible from all code within the same assembly or project.
33. `RaiseEvent`: Used to raise an event, invoking any associated event handlers.
34. `ReadOnly`: Specifies that a variable or property can only be assigned a value during declaration or in the constructor.
35. `ReDim`: Used to dynamically resize an array.
36. `Shared`: Indicates that a member belongs to the class itself, rather than instances of the class.
37. `Shadows`: Used to hide a base class member with a member of the same name in a derived class.
38. `Structure`: Used to define a structure, which is a value type that can contain data members and methods.
39. `SyncLock`: Used to create a lock that ensures mutually exclusive access to a shared resource in a multithreaded environment.
40. `While`: Creates a loop that executes a block of code while a specified condition is true.
41. `With`: Used to specify a reference to an object or structure and allows multiple properties or methods to be accessed without specifying the object name repeatedly.
42. `Wend`: Used to mark the end of a While loop block.
43. `Write`: Used to output text, variables, or expressions to the standard output stream.
44. `WriteLine`: Similar to the `Write` keyword, but appends a line break after the output.
45. `Xor`: Performs a logical XOR operation, returning `True` if only one of the operands is `True`.
These keywords add to the expressive power of VB.NET and provide more flexibility when writing code.
These keywords provide additional functionality and control over the code flow in VB.NET. These are just a few examples of VB.NET keywords. Understanding and correctly using these keywords is essential for proper programming in VB.NET.
Up Vote(0) |
Down Vote(0 |
Views(173)
See Demo |
Download File