SLN Function won't work

  • 14 years ago

    Hi.

    I have a problem creating the code for the SLN Function.  It does not work in the solution at run-time. Here is what I created the code:

    Private

    Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click

    Dim Cost As Double

    Dim Life As Double

    Dim Salvage As Double

    Dim Depreciation As Double

    Cost = ToDouble(txtCost.Text)

    Life = ToDouble(txtLife.Text)

    Salvage = ToDouble(txtSalvage.Text)

    Depreciation = ToDouble(sln(Cost, Life, Salvage))

    Depreciation = System.Math.Abs(Depreciation)

    End Sub

    Regena.

  • 14 years ago
    Hi,

    It seems that SFL function was only in VB6 in VB 2005 you have to create it.

    This returns the annual depreciation.
    Public function sfl(byval cost as double, byval salvage as double, byval life as double) as double
    Return (Cost – Salvage) / Life
    End function
    




  • 14 years ago

    Thanks. I will work on it. Will let you know if it works.

     

    Regena

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“It works on my machine.” - Anonymous