Sideway
output.to from Sideway
Draft for Information Only

Content

VB.NET Assignment Operators
  = Operator
  Syntax
  Parts
  Remarks
  Overloading
  See also
  ^= Operator
  Syntax
  Parts
  Remarks
  Overloading
  See also
  *= Operator
  Syntax
  Parts
  Remarks
  Overloading
  See also
  /= Operator
  Syntax
  Parts
  Remarks
  Overloading
  See also
  \= Operator
  Syntax
  Parts
  Remarks
  Overloading
  See also
  += Operator
  Syntax
  Parts
  Remarks
  Overloading
  See also
  -= Operator
  Syntax
  Parts
  Remarks
 Overloading
  See also
  <<= Operator
  Syntax
  Parts
  Remarks
  Overloading
  See also
  >>= Operator
  Syntax
  Parts
  Remarks
  Overloading
  See also
  &= Operator
  Syntax
  Parts
  Remarks
  Overloading
  See also
  Source/Reference

VB.NET Assignment Operators

The supporting VB.NET Assignment Operators are =, ^=, *=, /=, \=, +=, -=, <<=, >>=, &=.

= Operator

Assigns a value to a variable or property.

Syntax

variableorproperty = value  

Parts

variableorproperty: Any writable variable or any property.

value: Any literal, constant, or expression.

Remarks

The element on the left side of the equal sign (=) can be a simple scalar variable, a property, or an element of an array. The variable or property cannot be ReadOnly. The = operator assigns the value on its right to the variable or property on its left.

Note

The = operator is also used as a comparison operator. For details, see Comparison Operators.

Overloading

The = operator can be overloaded only as a relational comparison operator, not as an assignment operator. For more information, see Operator Procedures.

See also

^= Operator

Raises the value of a variable or property to the power of an expression and assigns the result back to the variable or property.

Syntax

variableorproperty ^= expression  

Parts

variableorproperty: Required. Any numeric variable or property.

expression: Required. Any numeric expression.

Remarks

The element on the left side of the ^= operator can be a simple scalar variable, a property, or an element of an array. The variable or property cannot be ReadOnly.

The ^= operator first raises the value of the variable or property (on the left-hand side of the operator) to the power of the value of the expression (on the right-hand side of the operator). The operator then assigns the result of that operation back to the variable or property.

Visual Basic always performs exponentiation in the Double Data Type. Operands of any different type are converted to Double, and the result is always Double.

The value of expression can be fractional, negative, or both.

Overloading

The ^ Operator can be overloaded, which means that a class or structure can redefine its behavior when an operand has the type of that class or structure. Overloading the ^ operator affects the behavior of the ^= operator. If your code uses ^= on a class or structure that overloads ^, be sure you understand its redefined behavior. For more information, see Operator Procedures.

See also

*= Operator

Multiplies the value of a variable or property by the value of an expression and assigns the result to the variable or property.

Syntax

variableorproperty *= expression  

Parts

variableorproperty: Required. Any numeric variable or property.

expression: Required. Any numeric expression.

Remarks

The element on the left side of the *= operator can be a simple scalar variable, a property, or an element of an array. The variable or property cannot be ReadOnly.

The *= operator first multiplies the value of the expression (on the right-hand side of the operator) by the value of the variable or property (on the left-hand side of the operator). The operator then assigns the result of that operation to the variable or property.

Overloading

The * Operator can be overloaded, which means that a class or structure can redefine its behavior when an operand has the type of that class or structure. Overloading the * operator affects the behavior of the *= operator. If your code uses *= on a class or structure that overloads *, be sure you understand its redefined behavior. For more information, see Operator Procedures.

See also

/= Operator

Divides the value of a variable or property by the value of an expression and assigns the floating-point result to the variable or property.

Syntax

variableorproperty /= expression  

Parts

variableorproperty: Required. Any numeric variable or property.

expression: Required. Any numeric expression.

Remarks

The element on the left side of the /= operator can be a simple scalar variable, a property, or an element of an array. The variable or property cannot be ReadOnly.

The /= operator first divides the value of the variable or property (on the left-hand side of the operator) by the value of the expression (on the right-hand side of the operator). The operator then assigns the floating-point result of that operation to the variable or property.

This statement assigns a Double value to the variable or property on the left. If Option Strict is On, variableorproperty must be a Double. If Option Strict is Off, Visual Basic performs an implicit conversion and assigns the resulting value to variableorproperty, with a possible error at run time. For more information, see Widening and Narrowing Conversions and Option Strict Statement.

Overloading

The / Operator (Visual Basic) can be overloaded, which means that a class or structure can redefine its behavior when an operand has the type of that class or structure. Overloading the / operator affects the behavior of the /= operator. If your code uses /= on a class or structure that overloads /, be sure you understand its redefined behavior. For more information, see Operator Procedures.

See also

\= Operator

Divides the value of a variable or property by the value of an expression and assigns the integer result to the variable or property.

Syntax

variableorproperty \= expression  

Parts

variableorproperty: Required. Any numeric variable or property.

expression: Required. Any numeric expression.

Remarks

The element on the left side of the \= operator can be a simple scalar variable, a property, or an element of an array. The variable or property cannot be ReadOnly.

The \= operator divides the value of a variable or property on its left by the value on its right, and assigns the integer result to the variable or property on its left

For further information on integer division, see \ Operator (Visual Basic).

Overloading

The \ operator can be overloaded, which means that a class or structure can redefine its behavior when an operand has the type of that class or structure. Overloading the \ operator affects the behavior of the \= operator. If your code uses \= on a class or structure that overloads \, be sure you understand its redefined behavior. For more information, see Operator Procedures.

See also

+= Operator

Adds the value of a numeric expression to the value of a numeric variable or property and assigns the result to the variable or property. Can also be used to concatenate a String expression to a String variable or property and assign the result to the variable or property.

Syntax

variableorproperty += expression  

Parts

variableorproperty: Required. Any numeric or String variable or property.

expression: Required. Any numeric or String expression.

Remarks

The element on the left side of the += operator can be a simple scalar variable, a property, or an element of an array. The variable or property cannot be ReadOnly.

The += operator adds the value on its right to the variable or property on its left, and assigns the result to the variable or property on its left. The += operator can also be used to concatenate the String expression on its right to the String variable or property on its left, and assign the result to the variable or property on its left.

Note

When you use the += operator, you might not be able to determine whether addition or string concatenation will occur. Use the &= operator for concatenation to eliminate ambiguity and to provide self-documenting code.

This assignment operator implicitly performs widening but not narrowing conversions if the compilation environment enforces strict semantics. For more information on these conversions, see Widening and Narrowing Conversions. For more information on strict and permissive semantics, see Option Strict Statement.

If permissive semantics are allowed, the += operator implicitly performs a variety of string and numeric conversions identical to those performed by the + operator. For details on these conversions, see + Operator.

Overloading

The + operator can be overloaded, which means that a class or structure can redefine its behavior when an operand has the type of that class or structure. Overloading the + operator affects the behavior of the += operator. If your code uses += on a class or structure that overloads +, be sure you understand its redefined behavior. For more information, see Operator Procedures.

See also

-= Operator

Subtracts the value of an expression from the value of a variable or property and assigns the result to the variable or property.

Syntax

variableorproperty -= expression  

Parts

variableorproperty: Required. Any numeric variable or property.

expression: Required. Any numeric expression.

Remarks

The element on the left side of the -= operator can be a simple scalar variable, a property, or an element of an array. The variable or property cannot be ReadOnly.

The -= operator first subtracts the value of the expression (on the right-hand side of the operator) from the value of the variable or property (on the left-hand side of the operator). The operator then assigns the result of that operation to the variable or property.

Overloading

The - Operator (Visual Basic) can be overloaded, which means that a class or structure can redefine its behavior when an operand has the type of that class or structure. Overloading the - operator affects the behavior of the -= operator. If your code uses -= on a class or structure that overloads -, be sure you understand its redefined behavior. For more information, see Operator Procedures.

See also

<<= Operator

Performs an arithmetic left shift on the value of a variable or property and assigns the result back to the variable or property.

Syntax

variableorproperty <<= amount  

Parts

variableorproperty: Required. Variable or property of an integral type (SByte, Byte, Short, UShort, Integer, UInteger, Long, or ULong).

amount: Required. Numeric expression of a data type that widens to Integer.

Remarks

The element on the left side of the <<= operator can be a simple scalar variable, a property, or an element of an array. The variable or property cannot be ReadOnly.

The <<= operator first performs an arithmetic left shift on the value of the variable or property. The operator then assigns the result of that operation back to that variable or property.

Arithmetic shifts are not circular, which means the bits shifted off one end of the result are not reintroduced at the other end. In an arithmetic left shift, the bits shifted beyond the range of the result data type are discarded, and the bit positions vacated on the right are set to zero.

Overloading

The << Operator can be overloaded, which means that a class or structure can redefine its behavior when an operand has the type of that class or structure. Overloading the << operator affects the behavior of the <<= operator. If your code uses <<= on a class or structure that overloads <<, be sure you understand its redefined behavior. For more information, see Operator Procedures.

See also

>>= Operator

Performs an arithmetic right shift on the value of a variable or property and assigns the result back to the variable or property.

Syntax

variableorproperty >>= amount  

Parts

variableorproperty: Required. Variable or property of an integral type (SByte, Byte, Short, UShort, Integer, UInteger, Long, or ULong).

amount: Required. Numeric expression of a data type that widens to Integer.

Remarks

The element on the left side of the >>= operator can be a simple scalar variable, a property, or an element of an array. The variable or property cannot be ReadOnly.

The >>= operator first performs an arithmetic right shift on the value of the variable or property. The operator then assigns the result of that operation back to the variable or property.

Arithmetic shifts are not circular, which means the bits shifted off one end of the result are not reintroduced at the other end. In an arithmetic right shift, the bits shifted beyond the rightmost bit position are discarded, and the leftmost bit is propagated into the bit positions vacated at the left. This means that if variableorproperty has a negative value, the vacated positions are set to one. If variableorproperty is positive, or if its data type is an unsigned type, the vacated positions are set to zero.

Overloading

The >> Operator can be overloaded, which means that a class or structure can redefine its behavior when an operand has the type of that class or structure. Overloading the >> operator affects the behavior of the >>= operator. If your code uses >>= on a class or structure that overloads >>, be sure you understand its redefined behavior. For more information, see Operator Procedures.

See also

&= Operator

Concatenates a String expression to a String variable or property and assigns the result to the variable or property.

Syntax

variableorproperty &= expression  

Parts

variableorproperty: Required. Any String variable or property.

expression: Required. Any String expression.

Remarks

The element on the left side of the &= operator can be a simple scalar variable, a property, or an element of an array. The variable or property cannot be ReadOnly. The &= operator concatenates the String expression on its right to the String variable or property on its left, and assigns the result to the variable or property on its left.

Overloading

The & Operator can be overloaded, which means that a class or structure can redefine its behavior when an operand has the type of that class or structure. Overloading the & operator affects the behavior of the &= operator. If your code uses &= on a class or structure that overloads &, be sure you understand its redefined behavior. For more information, see Operator Procedures.

See also

Source/Reference


©sideway

ID: 200800005 Last Updated: 8/5/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