Max Function

   
Max Function

Class

System.Math

Syntax

 Math.Max(   val1   ,   val2   ) 
val1 , val2 (required; any)

A numeric data type or expression

Return Value

Returns the maximum of val1 and val2 , in the widest datatype of the two numbers

Description

Returns the maximum of val1 and val2

Rules at a Glance

  • If the two arguments do not have the same data type, then the narrower data type is cast to the wider type. For instance, the line:

     Dim x As Integer = 5 Dim y As Double = 454.8 MsgBox(Math.Max(x, y)) 

    displays 454.8.

  • This is a Shared member, so it can be used without creating any objects.

VB.NET/VB 6 Differences

The Max function is new to the .NET Framework.

See Also

Min Function

   


VB.Net Language in a Nutshell
VB.NET Language in a Nutshell
ISBN: B00006L54Q
EAN: N/A
Year: 2002
Pages: 503

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net