Vb.net Visual Basic图书租赁程序失败
//当我运行程序时,会显示扩展价格、15%折扣和折扣价格,但其余部分仍然为空,我会收到此错误消息“方法或操作未实现”。。。我做错了什么Vb.net Visual Basic图书租赁程序失败,vb.net,Vb.net,//当我运行程序时,会显示扩展价格、15%折扣和折扣价格,但其余部分仍然为空,我会收到此错误消息“方法或操作未实现”。。。我做错了什么 Public Class bookSalesForm 'Dimension Constants Const DISCOUNT_RATE_Decimal As Decimal = 0.15D 'Dimension Modular Variables Private Quantitysuminteger, SaleCountInt
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
其实很简单。 这一行:
quantitysumlabel.text = DiscountSuminteger.ToString()
调用此函数:
Private Function DiscountSuminteger() As Object
Throw New NotImplementedException
End Function
这意味着将抛出NotImplementedException:)谢谢您的编辑。可能是重复的是,这是我刚启动此程序时的老问题。我走得更远了,所以我用不同的方式问了这个问题,因为这是一个完全不同的问题。没关系,我发现了你的意思。尽管如此,总的图书数量和总的折扣仍然是空白的:/你必须粘贴你的新代码,我才能弄清楚。