Errors on visual studio – Stack Overflow


Book Sales due 4/12/2024
Description: This project inputs sales information for books.
It calculates the extended price and discount for a sale.
Uses variables, constants, and calculations.

Using Visual Studio and Visual Basic Language.

Errors:
BC30451 ‘Form1’ is not declared. It may be inaccessible due to its protection level. Book Sales C:\Users\juliana\Desktop\Book Sales\My Project\Application.Designer.vb 34 Active

BC30311 Value of type ‘Decimal’ cannot be converted to ‘Label’. Book Sales C:\Users\juliana\Desktop\Book Sales\BookSaleForm.vb 18 Active

BC30451 ‘Form1’ is not declared. It may be inaccessible due to its protection level. Book Sales C:\Users\juliana\Desktop\Book Sales\My Project\Application.Designer.vb 34 Active

Public Class BookSaleForm

This is my code:
Public Class BookSaleForm
‘ Declare the constant.
Const DISCOUNT_RATE_Decimal As Decimal = 0.15D

Private Sub CalculateButton_Click(ByVal sender As System.Object,
   ByVal e As System.EventArgs) Handles CalculateButton.Click

    ' Calculate the price and discount.
    Dim QuantityInteger As Integer
    Dim PriceDecimal, ExtendedPriceDecimal, DiscountDecimal,
       DiscountedPriceDecimal As Decimal

    ' Convert input values to numeric variables.
    QuantityInteger = Integer.Parse(QuantityTextBox.Text)
    PriceDecimal = Decimal.Parse(PriceTextBox.Text)

    ' Calculate values.
    ExtendedPriceDecimal = QuantityInteger * PriceDecimal
    DiscountDecimal = Decimal.Round( _
     (ExtendedPriceDecimal * DISCOUNT_RATE_Decimal), 2)
    DiscountedPriceDecimal = ExtendedPriceDecimal - DiscountDecimal

    ' Format and display answers.
    ExtendedPriceTextBox.Text = ExtendedPriceDecimal.ToString("C")
    DiscountTextBox.Text = DiscountDecimal.ToString("N")
    DiscountedPriceTextBox.Text = DiscountedPriceDecimal.ToString("C")
End Sub

Private Sub ClearButton_Click(ByVal sender As System.Object,
  ByVal e As System.EventArgs) Handles clearButton.Click
    ' Clear previous amounts from the form.

    TitleTextBox.Clear()
    PriceTextBox.Clear()
    ExtendedPriceTextBox.Clear()
    DiscountTextBox.Clear()
    DiscountedPriceTextBox.Clear()
    With QuantityTextBox
        .Clear()
        .Focus()
    End With
End Sub



Private Sub ExitButton_Click(ByVal sender As System.Object,
  ByVal e As System.EventArgs) Handles ExitButton.Click
    ' Exit the project.

    Me.Close()
End Sub

End Class

Leave a Reply

Your email address will not be published. Required fields are marked *