I attempted to look up this in my visual basic textbook, but it seems useless to my eyes but borrowing your brains would be helpful, how can I call this function? It brings up the error - would you be able to correct it?
Private Sub btnCost_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCost.Click [B]DVDCosts()[/B] lblResults.Text = "Costs of Renting " & dvds(ix).category & txtDays.Text & " = $" & totalCost End Sub Function DVDCosts(ByVal rental As Decimal, ByVal days As Integer, ByVal activity As String) As Decimal Const RegularDiscount As Single = 0.95 Const FrequentDiscount As Single = 0.9 Const DaysWithoutDiscount As Integer = 7 Dim DayDiscount = 0 'Dim Totalcost As Integer Do While (totalDays > DaysWithoutDiscount) Then DayDiscount = totalDays - DaysWithoutDiscount Loop totalCost = (totalDays * rental) - DayDiscount Return totalCost If (activity = "R") Then totalCost = totalCost * RegularDiscount ElseIf (activity = "optFreq") Then totalCost = totalCost * FrequentDiscount End If End Function
You see, the bold text above the function code, is it the correct method to call the function? if not, could you correct me please? Thank you for your apperication in this. :thumbup1:


Sign In
Create Account


Back to top









