Visual Basic图书租赁程序失败

时间:2013-09-25 08:10:37

标签: vb.net

//延长价格,15%折扣和折扣价格在我运行程序时显示,但其余部分仍为空,我收到此错误消息“方法或操作未实现”...我做错了什么?

Public Class bookSalesForm
    'Dimension Constants
    Const DISCOUNT_RATE_Decimal As Decimal = 0.15D


    'Dimension Modular Variables
    Private Quantitysuminteger, SaleCountInteger As Integer
    Private DiscountSumDecimal, DiscountedPriceSumDecimal As Decimal





    Private Sub printButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles printButton.Click
        PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview
        PrintForm1.Print()
    End Sub

    Private Sub calculateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calculateButton.Click
        'Dimension Local Variables
        Dim QuantityInteger As Integer
        Dim PriceDecimal, ExtendedPriceDecimal, DiscountDecimal, DiscountedPriceDecimal, AverageDiscountDecimal As Decimal




        Try
            'convert quantity to numeric
            QuantityInteger = Integer.Parse(QuantityTextBox.text)


            Try
                'convert price to numeric
                PriceDecimal = Decimal.Parse(priceTextBox.Text)



                'calculate values for single sale
                ExtendedPriceDecimal = QuantityInteger * PriceDecimal
                DiscountDecimal = Decimal.Round(
                    (ExtendedPriceDecimal * DISCOUNT_RATE_Decimal), 2)
                DiscountedPriceDecimal = ExtendedPriceDecimal - DiscountDecimal


                'display formatted single sale values

                ExtendedPriceLabel.Text = ExtendedPriceDecimal.ToString("C")
                DiscountLabel.Text = DiscountDecimal.ToString("N")
                DiscountedPriceLabel.Text = DiscountedPriceDecimal.ToString("C")
                quantitysumlabel.text = DiscountSuminteger.ToString()
                Discountsumlabel.text = DiscountSumDecimal.ToString("C")
                averageDiscountLabel.Text = AverageDiscountDecimal.ToString("C")



                'accumulate (add to ) summary values

                Quantitysuminteger += QuantityInteger
                DiscountSumDecimal += DiscountDecimal
                SaleCountInteger += 1
                DiscountedPriceSumDecimal += DiscountedPriceSumDecimal / SaleCountInteger





                'display formatted summary values

                ExtendedPriceLabel.Text = Quantitysuminteger.ToString("C")
                DiscountLabel.Text = DiscountDecimal.ToString("n")
                DiscountedPriceLabel.Text = DiscountedPriceDecimal.ToString("C")







            Catch PriceException As FormatException

            End Try

        Catch QuantityExceptioin As FormatException
            'Format Exception for quantity conversion
            MessageBox.Show("price must be numeric. ", "data entry error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            With priceTextBox
                .Focus()
                .SelectAll()

            End With

        Catch anException As Exception
            'Any other exception
            MessageBox.Show("Error: " & anException.Message)
        End Try

    End Sub

    Private Sub clearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles clearButton.Click
        titleTextBox.Clear()
        priceTextBox.Clear()
        QuantityTextBox.Clear()






    End Sub

    Private Sub exitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitButton.Click
        Me.Close()
    End Sub

    Private Sub bookSalesForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Function DiscountSuminteger() As Object
        Throw New NotImplementedException
    End Function

    Private Function Quantitysumlabel() As Object
        Throw New NotImplementedException
    End Function

    Private Function Discountsumlabel() As Object
        Throw New NotImplementedException
    End Function

End Class

1 个答案:

答案 0 :(得分:2)

实际上非常简单。 这一行:

quantitysumlabel.text = DiscountSuminteger.ToString()

调用此函数:

Private Function DiscountSuminteger() As Object
    Throw New NotImplementedException
End Function

这意味着将抛出NotImplementedException:)