BIGELOJ

asked on

# How do you use the LN function that is found on a Business Calculator in Visual Basic?

I need to know how call a function in Visual Basic that does the same thing as the LN button on a business calculator. I found the following on this site:

Private Function Ln(ByVal Number As Double) As Double

Ln = Log(Number) / Log(Exp(1))

End Function

I get errors stating that the Log and Exp portions have not been declared. I thought that these were built-in function of VB?

My other part of my code calls this function as follows:

'Now Call the function that performs the LN portion on a calculator

Dim dblLN1, dblLN2 As Double

dblLN1 = Ln(dblNumerator)

dblLN2 = Ln(dblDenominator)

I am using Visual Studio 2008. Any help would be GREATLY appreciated.

Private Function Ln(ByVal Number As Double) As Double

Ln = Log(Number) / Log(Exp(1))

End Function

I get errors stating that the Log and Exp portions have not been declared. I thought that these were built-in function of VB?

My other part of my code calls this function as follows:

'Now Call the function that performs the LN portion on a calculator

Dim dblLN1, dblLN2 As Double

dblLN1 = Ln(dblNumerator)

dblLN2 = Ln(dblDenominator)

I am using Visual Studio 2008. Any help would be GREATLY appreciated.

Her you go - http://msdn.microsoft.com/en-us/library/5xkbf3yw(VS.85).aspx

You can use Math.Log like such.

Dim i As Integer

i = Math.Log(5)

Log(Double) Returns the natural (base e) logarithm of a specified number.

Log(Double, Double) Returns the logarithm of a specified number in a specified base.

Dim i As Integer

i = Math.Log(5)

Log(Double) Returns the natural (base e) logarithm of a specified number.

Log(Double, Double) Returns the logarithm of a specified number in a specified base.

ASKER CERTIFIED SOLUTION

membership

This solution is only available to members.

To access this solution, you must be a member of Experts Exchange.

ASKER

If LOG() in VB is natural logarithm then why is it asking me to declare it as a variable and it is not listed when I try to select it. Please see the Image.

LN.JPG

LN.JPG

SOLUTION

membership

This solution is only available to members.

To access this solution, you must be a member of Experts Exchange.

ASKER

I want the points divided equally between hades666 and techhealth.

Thank you.