VB.Net Variables

VB.Net - Variables : A variable is nothing but a name given to a storage space that our programs can use. Data type helps to determine the type of data that can be stored with any flexibility. Variables belonging to different types of data are provided with different amounts of space in memory. Many types of data are available on VB.NET that includes:

Date: It is a storage area made up of 8 bytes. In this case, rates from 0:00:00 (midnight) January 1, 0001 to 11:59:59 PM of December 31, 9999.

Char: It contains shared space of 2 bytes. In this case, prices range from 0 to 65535 (unsigned).

Byte: It has a limited 1 byte allotted space. In this case, prices range from 0 to 255 (unsigned).

Boolean: In this case, shared storage depends on the utility platform. Its value can be true or false.

Thread: In this case, the allocated storage space depends on the operating platform. In this case, the numbers range from 0 to 2 billion Unicode.

Total number: 4 storage space. In this regard, prices range from 2,147,483,648 to 2,147,483,647 (signed).

Long: It has 8 storage by 8 bytes. In this case, the numbers range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 (signed).

Variable is the name given to the storage space that our programs can use. All variables in VB.Net have some form that determines the composition and size of the variable memory; the extent of the numbers that can be kept within that memory; and a flexible working set of variables.

TypeExample
Integral typesSByte, Byte, Short, UShort, Integer, UInteger, Long, ULong and Char
Floating point typesSingle and Double
Decimal typesDecimal
Boolean typesTrue or False values, as assigned
Date typesDate

Many types of data have been discussed earlier. The basic values ??provided on VB.Net can be categorized as -

VB.Net also allows for the definition of different price types for variables such as Enum and flexible reference types such as Class.

Variable Declaration on VB.Net

Dim Statement is used for different declarations and storage allocations for one or more variants. Dim Statement is also used in module, class, process, building or block level.

Access modifier – It defines flexible access levels, with values ??such as - Public, Protected, Friend, Friend, Protected and Private.

Attribute list - List of attributes that apply to variables.

Shadows - Indicates that the variable re-announces and hides something like a name, or set of overloaded objects, in the base class.

Static – It indicates that the variable will retain its value, even after completion of the process announced in it.

Shared – It declares shared variables, and is not associated with any particular category or structure, but is found in all category or building conditions.

Variable list – It provides a list of declared variables.

ReadOnly – It means the variables can be read, but cannot be transcribed.

WithEvents – It specifies that variables are used to respond to events suggested by the example given in the variable.

All variables in the variable list have the following syntax and components -

Variable name - It is a variable name.

boundslist - It provides a list of parameters for each size variation of the array variable.

New - It creates a new classroom model where the Dim statement works.

Datatype - Required when Option Strict is on. Specifies the variable data type.

Start - If new is not specified, an adjective is checked and given a variable when constructed.

Lvalues and Rvalues -

There are two different types of definitions -

lvalue - It is an expression equal to the lvalue that may appear on the left or right side of the assignment.

rvalue - It is a rvalue expression that can appear on the right - but not on the left side of the assignment.

The variables are the lvalues and most of them come from the left side of the assignment. Rvalues are numerical documents so they may not be shared and may not appear on the left side. The following is a valid statement -

Dim g As Total Price = 20

However, tracking is not a valid statement and will generate default time error -

20 = g