How to fix this parameter?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Michael Wise

    #1

    How to fix this parameter?

    My Code

    Code:
    Private Sub btncalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncalculate.Click
            Dim oldBalance, charges, credits As Double
            InputData(oldBalance, charges, credits)
            DisplayData(NewBalance(oldBalance, charges, credits), MinPayment(NewBalance(oldBalance, charges, credits)))
    
        End Sub
        Sub InputData(ByRef oldBalance As Double, ByRef charges As Double, ByRef credits As Double)
            oldBalance = CDbl(txtoldBalance.Text)
            charges = CDbl(txtcharges.Text)
            credits = CDbl(txtcredits.Text)
    
        End Sub
        Function NewBalance(ByVal oldBalance As Double, ByVal charges As Double, ByVal credits As Double)
            NewBalance = oldBalance + charges - credits + (oldBalance * 0.015)
            
    
        End Function
        Function MinPayment(ByVal NewBalance As Double, ByVal oldBalance As Double, ByVal charges As Double, ByVal credits As Double) As Double
            If NewBalance <= 20 Then
                Return NewBalance
            Else
                Return 20 + (NewBalance - 20 * 0.1)
    
            End If
    
        End Function
    
        Sub DisplayData(ByVal NewBalance As Double, ByVal MinPayment As Double)
            txtNewBalance.Text = FormatCurrency(NewBalance)
            txtMinPayment.Text = FormatCurrency(MinPayment)
    
    
        End Sub
    
        Private Sub btnexit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnexit.Click
            Me.Close()
    
        End Sub
    End Class
    blue lines under this
    Code:
    code-MinPayment(NewBalance(oldBalance, charges, credits)))
    error 1- argument not specified for parameter 'charges' Public Function(NewBal ance As Double,oldBalan ce As Double, charges As Double, credits As Double) As Double

    error 2-argument not specified for parameter 'credits' Public Function(NewBal ance As Double,oldBalan ce As Double, charges As Double, credits As Double) As Double

    error 3-argument not specified for parameter 'oldBalance' Public Function(NewBal ance As Double,oldBalan ce As Double, charges As Double, credits As Double) As Double
    Last edited by Atli; Nov 10 '10, 12:14 AM. Reason: Please use [code] tags when posting code.
  • Rodney Roe
    New Member
    • Oct 2010
    • 61

    #2
    It looks like you havn't filled out your args all the way,
    this is what you have;
    Code:
    DisplayData(NewBalance(oldBalance, charges, credits), _ 
    MinPayment(NewBalance(oldBalance, charges, credits)))
    this is what it should be;
    Code:
    DisplayData(NewBalance(oldBalance, charges, credits), _ 
    MinPayment(NewBalance(oldBalance, charges, credits),oldBalance,charges,credits))
    notice the extra ,oldBalance,cha rges,credits they fullfill the other minPayment args.

    Hope this helps,

    Comment

    Working...