What's the square root code in vb 2005?  
Author Message
Davinci_991





PostPosted: Visual Basic Express Edition, What's the square root code in vb 2005? Top

Hi Friends

I am really new in visual Basic, I knew that the square root code in vb 6 was sqr

but in vb 2005, it doesn't work

Help, Please

Thanks very much..................



Visual Studio Express Editions24  
 
 
ahmedilyas





PostPosted: Visual Basic Express Edition, What's the square root code in vb 2005? Top

try:

Math.Sqrt(doubleValue)



 
 
Brendan Grant





PostPosted: Visual Basic Express Edition, What's the square root code in vb 2005? Top

The .NET framework puts most of the important math functions you will deal with inside of the Math class and to get the square root of a number you simply call it's Sqrt() method:

Math.Sqrt(25)



 
 
Lawrex





PostPosted: Visual Basic Express Edition, What's the square root code in vb 2005? Top

Which systems must we import if we were to make use of the math. function

Pls advice



 
 
Dave299





PostPosted: Visual Basic Express Edition, What's the square root code in vb 2005? Top

System.Math


 
 
Spidermans_DarkSide





PostPosted: Visual Basic Express Edition, What's the square root code in vb 2005? Top

Which systems must we import if we were to make use of the math. function

Pls advice

Hi Lawrex,

I find i can use Math.Sqrt without the Imports statement in a FORM.

Like myNumber=Math.Sqrt(777)

You may possibly want to use the IMPORTS statement at the start of a new separate CLASS code section or in a Module though i guess.

If you do use.>>

Imports System.Math

Then you can use Sqrt on its own like this.>>

myNumber = Sqrt(999)

I also discovered

Imports Microsoft.VisualBasic.VBMath

Imports System.Math

What's the difference if any

Regards,

S_DS



 
 
ReneeC





PostPosted: Visual Basic Express Edition, What's the square root code in vb 2005? Top

There's lot's of difference.

Microsoft.VisualBasic.VBMath handles old VB6 forms such as variant datatypes and err.

I wouldn't use it. It's for supporting VB6 code.



 
 
Anonymous = Anonymous!





PostPosted: Visual Basic Express Edition, What's the square root code in vb 2005? Top

Hi Friends

I am really new in visual Basic, I knew that the square root code in vb 6 was sqr

but in vb 2005, it doesn't work

Help, Please

Thanks very much..................


 
 
Spidermans_DarkSide - MSP, VSIP





PostPosted: Visual Basic Express Edition, What's the square root code in vb 2005? Top

Hi Friends

I am really new in visual Basic, I knew that the square root code in vb 6 was sqr

but in vb 2005, it doesn't work

Help, Please

Thanks very much..................

Hi Anonymous = Anonymous!,

Try this then, add 1 button to a FORM and then PASTE this code in.>>>>

Code Snippet

Public Class Form1

'This next highlighted line should be one line of code in your code window.>>>>

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim response As String

Do

Do

response = InputBox("Type a number to find its square root please.")

Loop Until IsNumeric(response) = True

Dim mySqrt As Double = Math.Sqrt(CDbl(response))

MessageBox.Show("Square root of " & response & " = " & mySqrt.ToString)

'This next highlighted line should be one line of code in your code window.>>>>

response = MessageBox.Show("Find another square root ", "Another square root ", MessageBoxButtons.YesNo, MessageBoxIcon.Information)

Loop Until response = vbNo

If response = vbNo Then Application.Exit()

End Sub

End Class


Regards,

S_DS