Results 1 to 11 of 11

Thread: [RESOLVED] Errors that need fixing

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2018

    Resolved [RESOLVED] Errors that need fixing

    I have two errors coming up on my form (the bold areas) and Im not sure how to fix them..am I missing something??

    Here is my GroceryItemForm Code:

    Public Class GroceryItemForm
        Private Sub GroceryItemForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            Dim GroceryItemForm As New LoginForm
        End Sub
        Private Sub ExitToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ExitToolStripMenuItem.Click
        End Sub
        Private Sub ViewToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ViewToolStripMenuItem.Click
    'For Each item As GroceryItem In Basket
            'See GroceryItem.vb for Print() code
            Dim bdf As New BasketDisplayForm
           End Sub
        Private Sub btnAddToBasket_Click(sender As Object, e As EventArgs) Handles btnAddToBasket.Click, AddToolStripMenuItem.Click
            txtScanNumber.Text = txtBrandName.Text.Substring(0, 3) & "1019"
            Dim newGroceryItem As New GroceryItem (ERROR BC30516)(txtScanNumber.Text, txtBrandName.Text, numPrice.Value, txtDescription.Text,
                                            [Enum].Parse(GetType(Aisle), cboAisle.Text))
        End Sub
        Public Sub ??? Error BC30203 identifier expected
            txtScanNumber().Text = ""
            txtBrandName.Text = ""
            mPrice.Value = 0.0
            txtDescription.Text = ""
            cboAisle.SelectedIndex = -1
        End Sub
        Private Sub txtBrandName_TextChanged(sender As Object, e As EventArgs) Handles txtBrandName.TextChanged
        End Sub
    End Class

    This is my GroceryItem Code:

    Public Class GroceryItem
        Public _ScanNumber As Integer
        Public _BrandName As String
        Public _Description As String
        Public _Price As Double
        Public _Aisle As String
        'Unique serial item number
        Private mScanNumber As Integer
        Public ReadOnly Property ScanNumber As Integer
                Return mScanNumber
            End Get
        End Property
        'Item name
        Private mBrandName As String
        Public Property BrandName As String
                Return mBrandName
            End Get
            Set(value As String)
                mBrandName = value
            End Set
        End Property
        'Item description
        Private mDescription As String
        Public Property Description As String
                Return mDescription
            End Get
            Set(value As String)
                mDescription = value
            End Set
        End Property
        'Price amount
        Private mPrice As Double
        Public Property Price As Double
                Return mPrice
            End Get
            Set(value As Double)
                If value > 0 Then
                    mPrice = value
                End If
            End Set
        End Property
        'Grocery store aisle
        Private mAisle As String
        Public Property Aisle As String
                Return mAisle
            End Get
            Set(value As String)
                mAisle = value
            End Set
        End Property
        Public Sub New(scanNumber As String)
            Me.New(scanNumber, Nothing, 0)
        End Sub
        Public Sub New(ScanNumber As Integer, BrandName As String, price As Double, Aisle As String)
            Me.mScanNumber = ScanNumber
            Me.mBrandName = BrandName
            Me.mPrice = price
            Me.mAisle = Aisle
        End Sub
        Public Sub Print()
            MessageBox.Show("Aisle: " & Me.Aisle.ToString & vbCrLf & "Scan Number: " &
                            ScanNumber & vbCrLf & "Brand Name: " & Me.BrandName)
        End Sub
        Public Function Values() As String
            Return ScanNumber & "," & Me.BrandName & "," & Me.Price & "," &
            Me.Description & "," & Me.Aisle.ToString & vbCrLf
        End Function
    End Class
    Public Enum Aisle
    End Enum

    This is my Main code:

    Module Main
        Friend blnLoggedIn As Boolean
        Dim arrUsernames() As String = {"Admin", "Clerk", "Manager"}
        Dim arrPasswords() As String = {"P@ssword", "pa$$word", "passw0rd"}
        Dim userIndex As Integer
        Friend basket As New GroceryBasket
    And this is my GroceryBasket Code:

    Public Class GroceryBasket
        Inherits List(Of GroceryItem)
    End Class

    So those 2 errors are what im trying to figure out. My instructions were to :

    12. In the form’s Load event, display the login form modally and exit the application.

    13. In the Click event of the btnAddToBasket button,
    perform the following steps:

    a. Create a GroceryItem object using the values from the controls and add it to the basket variable. Note: Remember the basket variable is the
    GroceryBasket collection.

    b. Verify all controls except txtScanNumber contain a value.

    c. Set the value of the txtScanNumber control using the following code:
    txtScanNumber.Text = _
    txtBrandName.Text.Substring(0, 3) & “1019”

    d. Instantiate the GroceryItem class, using the control values.

    e. Use the following expression to set the Aisle property. The expression converts the text into an Aisle enumeration.
    [Enum].Parse(GetType(Aisle), cboAisle.Text)

    f. Add the GroceryItem object to the basket variable.

    14. In the Click event of the Exit menu item, end the application.

    15. Have the btnAddToBasket_Click method handle the Click event of AddToolStripMenuItem as well.

    16. In the Click event of the View menu item, display all of the items in the basket variable in an informational message box. You need only display the Aisle, ScanNumber and BrandName properties.

    Thanks for the help!!
    Last edited by EmilyM1105; Feb 8th, 2018 at 02:06 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts


Click Here to Expand Forum to Full Width