Skip to content

Latest commit

 

History

History
70 lines (57 loc) · 3.96 KB

File metadata and controls

70 lines (57 loc) · 3.96 KB
title * Operator (Visual Basic)
ms.date 07/20/2015
ms.prod .net
ms.reviewer
ms.suite
ms.technology
devlang-visual-basic
ms.topic article
f1_keywords
vb.*
helpviewer_keywords
arithmetic operators [Visual Basic], multiplication
operators [Visual Basic], multiplication
* operator [Visual Basic]
multiplication operator [Visual Basic], syntax
math operators [Visual Basic]
ms.assetid 2b210382-99da-4195-89ba-b1d06f5e89ad
caps.latest.revision 19
author dotnet-bot
ms.author dotnetcontent

* Operator (Visual Basic)

Multiplies two numbers.

Syntax

number1 * number2  

Parts

Term Definition
number1 Required. Any numeric expression.
number2 Required. Any numeric expression.

Result

The result is the product of number1 and number2.

Supported Types

All numeric types, including the unsigned and floating-point types and Decimal.

Remarks

The data type of the result depends on the types of the operands. The following table shows how the data type of the result is determined.

Operand data types Result data type
Both expressions are integral data types (SByte, Byte, Short, UShort, Integer, UInteger, Long, ULong) A numeric data type appropriate for the data types of number1 and number2. See the "Integer Arithmetic" tables in Data Types of Operator Results.
Both expressions are Decimal Decimal
Both expressions are Single Single
Either expression is a floating-point data type (Single or Double) but not both Single (note Decimal is not a floating-point data type) Double

If an expression evaluates to Nothing, it is treated as 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. If your code uses this operator on such a class or structure, be sure you understand its redefined behavior. For more information, see Operator Procedures.

Example

This example uses the * operator to multiply two numbers. The result is the product of the two operands.

[!code-vbVbVbalrOperators#4]

See Also

*= Operator
Arithmetic Operators
Operator Precedence in Visual Basic
Operators Listed by Functionality
Arithmetic Operators in Visual Basic