I can not tell if my array is not working at all. Any help appreciated would be great! Here is the code:

Friend Class pizzaarray
    Structure Size
        Dim sizedecimal As Decimal
        Dim crustdecimal As Decimal
    End Structure
    'Hold group number and total for 8 groups
    Private pizzaarray(7) As Array
End Class
'Lookup the pizza size and style for price
        Dim rowdecimal, columndecimal As Decimal
        Dim indexinteger As Integer = 0
        Dim pizzafoundboolean As Boolean
        Dim stylefoundboolean As Boolean
        Dim pizzadecimal As Decimal
        Dim pizzaarray As Decimal
        Dim pizzasize As Decimal
        Dim pizzastring As Decimal
        Dim stylestring As Decimal
        Dim styledecimal As Decimal

        With Me
            Try

                .sizeComboBox.SelectedText = Decimal.Parse(Me.sizeComboBox.SelectedText)
                Do Until pizzafoundboolean Or indexinteger > 3
                    If indexinteger = .sizeComboBox.SelectedIndex Then
                        pizzastring = indexinteger
                        pizzafoundboolean = True
                    Else
                        indexinteger += 1
                    End If
                Loop
                'Look up the crust style
                .sytleComboBox.SelectedText = Decimal.Parse(Me.sytleComboBox.SelectedText)
                Do Until stylefoundboolean Or indexinteger > 3
                    If indexinteger = .sytleComboBox.SelectedText Then
                        stylestring = indexinteger
                        stylefoundboolean = True
                    Else
                        indexinteger += 1
                    End If
                Loop

                'Display the pizza price
                Dim pricedecmial As Decimal

                If pizzafoundboolean And stylefoundboolean Then
                    Me.pizzaTextBox.Text = pricedecimal(indexinteger).ToString("C")
                End If

            Catch ex As Exception
                MessageBox.Show("Select size and style.", "Information missing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            End Try
        End With

Recommended Answers

All 2 Replies

Use this to check if "pizzafoundboolean/stylefoundboolean" are true or not.:

]If pizzafoundboolean And stylefoundboolean Then
[B]MessageBox.Show(pricedecimal(indexinteger).ToString("C"));[/B]
Me.pizzaTextBox.Text = pricedecimal(indexinteger).ToString("C")
End If

If the MessageBox() is not shown then none of them are true.

its not working. it states number of indicies is less than the number of dimensions of the indexed array. what now?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.