O'Reilly logo

VB.NET Language in a Nutshell, Second Edition by Steven Roman PhD, Paul Lomax, Ron Petrusha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

Sqrt Function

Class

System.Math

Syntax

Sqr(d)
d (required; Double)

Any numeric expression greater than or equal to 0

Return Value

A Double containing the square root of d

Description

Calculates the square root of a given number

Rules at a Glance

  • d must be equal to or greater than zero, or runtime error 5, “Invalid procedure call or argument,” occurs.

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

VB.NET/VB 6 Differences

The square root function in VB 6 is named Sqr, and it is an intrinsic VB function. In the .NET Framework, it is named Sqrt, and it is a member of the Math class in the System namespace.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required