2013-09-25 51 views
0

//延長價格,15%折扣和折扣價格顯示,當我運行程序,但其餘保持空白,我得到這個錯誤消息「的方法或操作未實現」.. 。 我究竟做錯了什麼?Visual Basic書籍租賃計劃失敗

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 
+0

謝謝你的編輯。 –

+0

[Visual Basic Room Rental Setup]的可能重複(http://stackoverflow.com/questions/18953668/visual-basic-room-rental-setup) –

+0

這是我剛開始使用這個程序時的老問題。我已經走得更遠了,所以我以不同的方式提出了這個問題,因爲這是一個不同的問題。 –

回答

2

其實很簡單。 這條線:

quantitysumlabel.text = DiscountSuminteger.ToString() 

調用這個函數:

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

這意味着該NotImplementedException將被拋出:)

+0

沒關係,我找到了你的意思。圖書總數和折扣總額仍然空白,但:/ –

+0

你將不得不粘貼你的新代碼,我想出了。 – WozzeC